| | |
| | | using Tiger.Model.MES.Yada; |
| | | using Apache.NMS.ActiveMQ.Commands; |
| | | using System.Diagnostics; |
| | | using static Microsoft.CodeAnalysis.CSharp.SyntaxTokenParser; |
| | | using Tiger.Model.Entitys.MES.U9C; |
| | | |
| | | namespace Tiger.Business.WMS.Transaction |
| | | { |
| | |
| | | /// </summary> |
| | | public class PrintSemiProdLabel : WMSTransactionBase, IPrintSemiProdLabel |
| | | { |
| | | private readonly IMES_U9C _IMES_U9C = DI.Resolve<IMES_U9C>(); |
| | | public IPrintSemiProdLabel Init(string id, string userCode, string apiHost, string orgCode) |
| | | { |
| | | TransID = id; |
| | |
| | | } |
| | | var DocLines = Biz.DataSource["YadaU9C"].Client.Ado.SqlQuery<mes_RcvRptDocLine>($"select * from mes_RcvRptDocLine where DocNo = '{input.SN}'"); |
| | | |
| | | var temps = new List<TemplateInput>(); |
| | | var temps = new List<SemiTemplateInput>(); |
| | | foreach (var item in DocLines) |
| | | { |
| | | var temp = new TemplateInput |
| | | var temp = new SemiTemplateInput |
| | | { |
| | | custCode="", |
| | | itemCode= item.ItemCode, |
| | | itemDesc= item.ItemDescription, |
| | | sapItemCode= "", |
| | | WoBatch = item.LotCode, |
| | | batchQty= item.PackQty, |
| | | qrCode="", |
| | | RcvRptDocId = item.ID.ToString(), |
| | | ItemCode= item.ItemCode, |
| | | ItemDesc= item.ItemDescription, |
| | | SapItemCode= "", |
| | | PackQty= item.PackQty.ToDecimal(), |
| | | Qty=0, |
| | | DocNo= item.DocNo, |
| | | WorkOrder= item.Mo |
| | | }; |
| | | temps.Add(temp); |
| | | } |
| | | |
| | | //var y = Biz.Db.Storageable(DocLines, UserCode) |
| | | // .WhereColumns(t => new { t.ItemCode, t.LotCode }) |
| | | // .ToStorage(); |
| | | //y.AsInsertable.ExecuteCommand(); |
| | | //y.AsUpdateable.IgnoreColumns(x => x.ID).ExecuteCommand(); |
| | | |
| | | action.Data.Data = temps; |
| | | action.LocaleMsg = Biz.L("WMS.PrintSemiProdLabel.Scan.ScanSuccessed"); |
| | |
| | | return SetOutPutMqttMsg(action, input.Locale); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 扫码提交 |
| | | /// </summary> |
| | | /// <param name="input"></param> |
| | | /// <returns></returns> |
| | | public async Task<ApiAction<ScanOutput>> ScanItem(BaseInput input) |
| | | { |
| | | var action = new ApiAction<ScanOutput>(new ScanOutput()); |
| | | try |
| | | { |
| | | if (input.SN.IsNullOrEmpty()) |
| | | { |
| | | action.IsSuccessed = false; |
| | | //action.LocaleMsg = Biz.L("条码不能为空"); |
| | | action.LocaleMsg = Biz.L("WMS.Default.ScanItem.SnEmptyFailure"); |
| | | return SetOutPutMqttMsg(action, input.Locale); |
| | | } |
| | | var semiTemplate = (input.Data ?? "").JsonToObject<SemiTemplateInput>() ?? new SemiTemplateInput(); |
| | | |
| | | //生成条码 |
| | | BarcodeCreateByAssignQtyInput barcodeCreateInput = new() |
| | | { |
| | | RevDocId = semiTemplate.RcvRptDocId, |
| | | userId = input.AuthOption.UserId, |
| | | token = "", |
| | | IsLogin = true, |
| | | CreateBarCodeItemQty = semiTemplate.PackQty, |
| | | LabelQty = semiTemplate.Qty, |
| | | }; |
| | | |
| | | var snList = await _IMES_U9C.U9CCreateBarCodeByAssignQty(barcodeCreateInput); |
| | | action.Data.Data = snList; |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | //action.CatchExceptionWithLog(ex, $"扫描[{input.SN}]提交异常"); |
| | | action.CatchExceptionWithLog(ex, Biz.L("WMS.PrintSemiProdLabel.ScanItem.ScanItemException", input.SN)); |
| | | |
| | | } |
| | | return SetOutPutMqttMsg(action, input.Locale); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | public override bool Close(bool needSaveHistoryLog = false) |