| | |
| | | using System.Data; |
| | | using System.Dynamic; |
| | | using MES.Service.DB; |
| | | using MES.Service.Dto.service; |
| | | using MES.Service.Modes; |
| | |
| | | var printCommandResult = Db.Queryable<MesBarcodeType>() |
| | | .Where(t => t.TypeCode == 108) |
| | | .First(); |
| | | if (printCommandResult == null) |
| | | { |
| | | throw new Exception("模版ID为空,请设置打印格式!"); |
| | | } |
| | | if (printCommandResult == null) throw new Exception("模版ID为空,请设置打印格式!"); |
| | | |
| | | var cPrintCommand = printCommandResult.Mbtype; |
| | | var cBid = printCommandResult.Id; |
| | |
| | | s.ItemNo == query.ItemNo && s.Factory == "1000" && |
| | | s.Company == "1000") |
| | | .First(); |
| | | if (cMesItems == null) |
| | | { |
| | | throw new Exception("物料信息不存在该物料编码,请维护!"); |
| | | } |
| | | if (cMesItems == null) throw new Exception("物料信息不存在该物料编码,请维护!"); |
| | | |
| | | if (string.IsNullOrEmpty(query.ItemNo)) |
| | | { |
| | | throw new Exception("请录入物料编码"); |
| | | } |
| | | if (string.IsNullOrEmpty(query.ItemNo)) throw new Exception("请录入物料编码"); |
| | | |
| | | if (string.IsNullOrEmpty(query.ItemModel)) |
| | | { |
| | | throw new Exception("请输入完物料编码后,点击确认生成规格!"); |
| | | } |
| | | |
| | | if (string.IsNullOrEmpty(query.OrgName)) |
| | | { |
| | | throw new Exception("请录入组织"); |
| | | } |
| | | if (string.IsNullOrEmpty(query.OrgName)) throw new Exception("请录入组织"); |
| | | |
| | | if (string.IsNullOrEmpty(query.OrgOwner)) |
| | | { |
| | | throw new Exception("请录入货主"); |
| | | } |
| | | if (string.IsNullOrEmpty(query.OrgOwner)) throw new Exception("请录入货主"); |
| | | |
| | | if (string.IsNullOrEmpty(query.ItemNum)) |
| | | { |
| | | throw new Exception("请录入物料数量"); |
| | | } |
| | | if (string.IsNullOrEmpty(query.ItemNum)) throw new Exception("请录入物料数量"); |
| | | |
| | | if (string.IsNullOrEmpty(query.Printnumn)) |
| | | { |
| | | throw new Exception("请录入条码数量"); |
| | | } |
| | | |
| | | var cId = |
| | | Db.Ado.GetInt( |
| | |
| | | .Where(it => it.CreateDate < DateTime.Now.AddDays(-10)) |
| | | .ExecuteCommand(); |
| | | |
| | | for (int i = 1; i <= int.Parse(query.Printnumn); i++) |
| | | for (var i = 1; i <= int.Parse(query.Printnumn); i++) |
| | | { |
| | | var cIndate = DateTime.Now.ToString("yyyyMMdd"); |
| | | |
| | |
| | | query.ItemNo + cIndate, query.ItemNo + cIndate, 0); |
| | | serial = barcodeResult.Value; |
| | | poBarcodeComand = barcodeResult.Msg; |
| | | if (!string.IsNullOrEmpty(poBarcodeComand)) |
| | | { |
| | | return null; |
| | | } |
| | | if (!string.IsNullOrEmpty(poBarcodeComand)) return null; |
| | | |
| | | if (string.IsNullOrEmpty(serial)) |
| | | { |
| | | cBarcode2 = "9"; |
| | | } |
| | | else |
| | | { |
| | | cBarcode2 = "9" + serial[1..]; |
| | | } |
| | | itemBarcode = query.ItemNo + cIndate + cBarcode2; |
| | | } |
| | | else |
| | |
| | | query.ItemNo + cIndate, query.ItemNo + cIndate, 0); |
| | | serial = barcodeResult.Value; |
| | | poBarcodeComand = barcodeResult.Msg; |
| | | if (!string.IsNullOrEmpty(poBarcodeComand)) |
| | | { |
| | | return null; |
| | | } |
| | | if (!string.IsNullOrEmpty(poBarcodeComand)) return null; |
| | | |
| | | cBarcode2 = "9" + serial.Substring(1); |
| | | itemBarcode = query.ItemNo + cIndate + |
| | |
| | | s.Company == "1000") |
| | | .Count(); |
| | | if (cCount == 0) |
| | | { |
| | | // Insert new barcode |
| | | Db.Insertable(new MesInvItemBarcodes |
| | | { |
| | |
| | | OrgName = query.OrgName, |
| | | OrgOwner = query.OrgOwner |
| | | }).ExecuteCommand(); |
| | | } |
| | | |
| | | // Insert record into MES_RF_PRNBARCODE |
| | | Db.Insertable(new MesRfPrnbarcode |
| | |
| | | Strp11 = poBarcode, |
| | | Strp12 = query.ItemName ?? " ", |
| | | Strp15 = query.OrgName ?? " ", |
| | | Strp16 = query.OrgOwner ?? " ", |
| | | Strp16 = query.OrgOwner ?? " " |
| | | }).ExecuteCommand(); |
| | | } |
| | | |
| | |
| | | var resultValue = outputResult.Value?.ToString(); |
| | | var messageValue = outputMessage.Value?.ToString(); |
| | | |
| | | dynamic m = new System.Dynamic.ExpandoObject(); |
| | | dynamic m = new ExpandoObject(); |
| | | m.Value = resultValue; |
| | | m.Msg = messageValue; |
| | | |