| | |
| | | var ship = db.Queryable<mes_ShipList>().Where(q => q.MoDoc == CurBatch.WO.ORDER_NO && q.Status == 2 && SqlFunc.DateIsSame(q.BusinessDate, DateTime.Now)).First(); |
| | | int CurShipQty = 0; |
| | | int WaitShipmentCarton = 0; |
| | | int WaitShipment = 0; |
| | | if (ship.IsNullOrEmpty()) { IsPrintCustomerLabel = false; } else |
| | | { |
| | | CurShipQty = ship.ShipQty; |
| | | IsPrintCustomerLabel = true; |
| | | SugarParameter[] pars = Biz.Db.Ado.GetParameters(new { BATCH = CurBatch.Batch.BATCH_NO, NodeIdOrName = curNode.NODE_NAME }); |
| | | var list = Biz.Db.Ado.UseStoredProcedure().GetDataTable("SP_MES_GET_NODE_BATCH_COUNT", pars).AsEnumerable().ToList(); |
| | | if (!list.IsNullOrEmpty()) |
| | | { |
| | | var batchCount = list.Where(q => q["ProdDate"].ToString() == "Whole").FirstOrDefault(); |
| | | WaitShipmentCarton = batchCount["WaitShipment"].ToInt32(); |
| | | IsPrintCustomerLabel = batchCount.IsNullOrEmpty() ? false : batchCount["WaitShipment"].ToInt32() >= ship.ShipQty ? false : true; |
| | | WaitShipmentCarton = batchCount["WaitShipmentCarton"].ToInt32(); |
| | | WaitShipment = batchCount["WaitShipment"].ToInt32(); |
| | | IsPrintCustomerLabel = batchCount.IsNullOrEmpty() ? IsPrintCustomerLabel : batchCount["WaitShipment"].ToInt32() >= ship.ShipQty ? false : true; |
| | | } |
| | | } |
| | | ShippingOrder = IsPrintCustomerLabel ? ship?.ShipDoc ?? "" : ""; |
| | |
| | | //} |
| | | //缓存出货箱数 |
| | | Context.SetOrAdd("CurWaitShipmentCarton", WaitShipmentCarton); |
| | | Context.SetOrAdd("CurWaitShipment", WaitShipment); |
| | | //if (Context.ContainsKey("CurWaitShipmentCarton")) |
| | | //{ |
| | | // Context["CurWaitShipmentCarton"] = WaitShipmentCarton; |
| | |
| | | var action = new ApiAction<ShipingInfo>(); |
| | | try |
| | | { |
| | | action.Data = new ShipingInfo() { IsPrintCustomerLabel= IsPrintCustomerLabel,ShipQty = Context["CurShipQty"].ToInt32() }; |
| | | 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() }; |
| | | } |
| | | catch (Exception ex) |
| | | { |