| | |
| | | ResetNode(); |
| | | //action.CatchExceptionWithLog(ex, $"包装工序:提交操作数据异常"); |
| | | action.CatchExceptionWithLog(ex, Biz.L("MES.Transaction.PackingNode.SubmitException")); |
| | | |
| | | |
| | | } |
| | | debug.Log(new StackFrame(true), "***** 9", info => { ConsoleExt.WriteLine(info.ToString()); }); |
| | | return SetOutPutMqttMsg(action, input.Locale); |
| | |
| | | debug.Log(new StackFrame(true), "***** 11", info => { ConsoleExt.WriteLine(info.ToString()); }); |
| | | |
| | | //获取出货状态 |
| | | var ship = U9CDB.Queryable<mes_ShipList>().Where(q => q.MoDoc == CurBatch.WO.ORDER_NO && q.Status == 2 && SqlFunc.DateIsSame(q.BusinessDate, DateTime.Now)).First(); |
| | | int CurShipQty = 0; |
| | | //var ship = U9CDB.Queryable<mes_ShipList>().Where(q => q.MoDoc == CurBatch.WO.ORDER_NO && q.Status == 2 && SqlFunc.DateIsSame(q.BusinessDate, DateTime.Now)).First(); |
| | | var ships = U9CDB.Queryable<mes_ShipList>().Where(q => q.MoDoc == CurBatch.WO.ORDER_NO).ToList(); |
| | | var shippingOrders = ships.Where(q=> q.Status != 2).Select(x=>x.ShipDoc).ToList(); |
| | | var oldShipment = ships.Any(q => q.Status != 2) ? ships.Where(x => x.Status != 2).Sum(t => t.ShipQty) : 0; |
| | | var ship = ships.Where(q => q.Status == 2 && q.BusinessDate.Date == DateTime.Now.Date).FirstOrDefault(); |
| | | decimal CurShipQty = 0; |
| | | int WaitShipmentCarton = 0; |
| | | int WaitShipment = 0; |
| | | int oWaitShipmentCarton = 0; |
| | | if (ship.IsNullOrEmpty()) { IsPrintCustomerLabel = false; } |
| | | else |
| | | { |
| | |
| | | var list = MainDB.Ado.UseStoredProcedure().GetDataTable("SP_MES_GET_NODE_BATCH_COUNT", pars).AsEnumerable().ToList(); |
| | | if (!list.IsNullOrEmpty()) |
| | | { |
| | | var sublist = list.Where(q=> shippingOrders.Contains(q["SHIPPING_ORDER"]) && q["ProdDate"].ToString() != "Whole").ToList(); |
| | | oWaitShipmentCarton = sublist.IsNullOrEmpty() ? 0 : sublist.Sum(q => q["WaitShipmentCarton"].ToInt32()); |
| | | var batchCount = list.Where(q => q["ProdDate"].ToString() == "Whole").FirstOrDefault(); |
| | | WaitShipmentCarton = batchCount["WaitShipmentCarton"].ToInt32(); |
| | | WaitShipmentCarton = batchCount["WaitShipmentCarton"].ToInt32()- oWaitShipmentCarton; |
| | | WaitShipment = batchCount["WaitShipment"].ToInt32(); |
| | | IsPrintCustomerLabel = batchCount.IsNullOrEmpty() ? IsPrintCustomerLabel : batchCount["WaitShipment"].ToInt32() >= ship.ShipQty ? false : true; |
| | | IsPrintCustomerLabel = batchCount.IsNullOrEmpty() ? IsPrintCustomerLabel : batchCount["WaitShipment"].ToInt32() - oldShipment >= ship.ShipQty ? false : true; |
| | | } |
| | | } |
| | | ShippingOrder = IsPrintCustomerLabel ? ship?.ShipDoc ?? "" : ""; |
| | | //缓存出货数量 |
| | | Context.SetOrAdd("CuroldShipment", oldShipment); |
| | | Context.SetOrAdd("CurShipQty", CurShipQty); |
| | | //缓存出货箱数 |
| | | Context.SetOrAdd("CurWaitShipmentCarton", WaitShipmentCarton); |
| | |
| | | wipSN.OPER_CODE = curNode.OPER_CODE; |
| | | wipSN.SEGMENT = curNode.SEGMENT; |
| | | wipSN.OPERATION_TIME = DateTime.Now; |
| | | wipSN.OPERATION_END = DateTime.Now; |
| | | wipSN.SHIPPING_ORDER = ShippingOrder; |
| | | wipSN.UNBIND_FLAG = "N"; |
| | | var curShiftPeriod = GetShiftPeriodForNow(); |
| | |
| | | wipSN.OPER_CODE = curNode.OPER_CODE; |
| | | wipSN.SEGMENT = curNode.SEGMENT; |
| | | wipSN.OPERATION_TIME = DateTime.Now; |
| | | wipSN.OPERATION_END = DateTime.Now; |
| | | } |
| | | |
| | | var wipHiss = new List<MES_WIP_HIS>(); |
| | |
| | | var db = GetCommitDB(); |
| | | //数据保存逻辑 |
| | | db.Updateable(_woSns, UserCode).UpdateColumns(q => new { q.UPDATE_TIME, q.UPDATE_USER, q.STATUS }).ExecuteCommand(); |
| | | db.Updateable(_wipSns, UserCode).UpdateColumns(q => new { q.UPDATE_TIME, q.UPDATE_USER, q.STATUS, q.NODE_ID, q.NODE_NAME, q.OPER_CODE, q.SEGMENT, q.OPERATION_TIME }).ExecuteCommand(); |
| | | db.Updateable(_wipSns, UserCode).UpdateColumns(q => new { q.UPDATE_TIME, q.UPDATE_USER, q.STATUS, q.NODE_ID, q.NODE_NAME, q.OPER_CODE, q.SEGMENT, q.OPERATION_TIME, q.OPERATION_END }).ExecuteCommand(); |
| | | db.Storageable(_wipHiss, UserCode).ExecuteCommand(); |
| | | if (_pkgList.Any()) |
| | | { |
| | |
| | | try |
| | | { |
| | | var CurPkg = Context.ContainsKey("CurPackage") ? Context["CurPackage"] as WipPkg : null; |
| | | var LabelPV = MainDB.Queryable<BAS_LABEL_PV>().ToList(); |
| | | var LabelPV = MainDB.Queryable<BAS_PROCESS_VAR>().ToList(); |
| | | var label = CurPkg.Item.LABEL_CODE.IsNullOrEmpty() ? null : MainDB.Queryable<BAS_LABEL_TEMP>().Where(q => q.LABEL_CODE == CurPkg.Item.LABEL_CODE).IncludesAllFirstLayer().First(); |
| | | var printLb = SetLabelVariables(LabelPV, label, new PackingAction(), CurPkg); |
| | | action.Data = new PackingActionOutput() |
| | |
| | | action.Data = new ShipingInfo() |
| | | { |
| | | IsPrintCustomerLabel = IsPrintCustomerLabel, |
| | | ShipQty = Context.GetOrDefault("CurWaitShipment").ToInt32() >= Context.GetOrDefault("CurShipQty").ToInt32() ? CurBatch.Batch.PLAN_QTY - Context.GetOrDefault("CurShipQty").ToInt32() : Context.GetOrDefault("CurShipQty").ToInt32() |
| | | OldShipQty = Context.GetOrDefault("CuroldShipment").ToInt32(), |
| | | ShipQty = Context.GetOrDefault("CurWaitShipment").ToInt32() - Context.GetOrDefault("CuroldShipment").ToInt32() >= Context.GetOrDefault("CurShipQty").ToInt32() ? CurBatch.Batch.PLAN_QTY - Context.GetOrDefault("CuroldShipment").ToInt32() - Context.GetOrDefault("CurShipQty").ToInt32() : Context.GetOrDefault("CurShipQty").ToInt32() |
| | | }; |
| | | } |
| | | catch (Exception ex) |