服务端的TigerApi 框架,基于.NET6 2024 版本
Ben Lin
2024-11-26 976d3ae1547b896cc5c7875408c09616d5c2ee55
Tiger.Business.MES/Transaction/YadaPacking.cs
@@ -393,20 +393,44 @@
                    //设置当前指令为正常产品过站
                    NodeCmd = "NodeSubmit";
                    curtime = DateTime.Now;  Logger.Console.Info($"{CurSN} : ***** 11 : {(curtime - prevtime).TotalSeconds}s", ConsoleColor.Green); prevtime = curtime;
                    //获取出货状态
                    DbClient db = Biz.DataSource["YadaU9C"].Client;
                    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;
                    if (ship.IsNullOrEmpty()) { IsPrintCustomerLabel = false; } else
                    {
                        CurShipQty = ship.ShipQty;
                        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;
                        }
                    }
                    ShippingOrder = IsPrintCustomerLabel ? ship?.ShipDoc ?? "" : "";
                    //缓存出货数量
                    if (Context.ContainsKey("CurShipQty"))
                    {
                        Context["CurShipQty"] = CurShipQty;
                    }
                    else
                    {
                        Context.Add("CurShipQty", CurShipQty);
                    }
                    //缓存出货箱数
                    if (Context.ContainsKey("CurWaitShipmentCarton"))
                    {
                        Context["CurWaitShipmentCarton"] = WaitShipmentCarton;
                    }
                    else
                    {
                        Context.Add("CurWaitShipmentCarton", WaitShipmentCarton);
                    }
                    curtime = DateTime.Now;  Logger.Console.Info($"{CurSN} : ***** 12 : {(curtime - prevtime).TotalSeconds}s", ConsoleColor.Green); prevtime = curtime;
                    //绑定条码到工单
                    foreach (var wipSN in wipSNs)
@@ -938,6 +962,24 @@
            return action;
        }
        /// <summary>
        /// 获取是否打印客户标签还是入库标签
        /// </summary>
        /// <returns></returns>
        public async Task<ApiAction<ShipingInfo>> GetIsCustomerLabelAndShipQty()
        {
            var action = new ApiAction<ShipingInfo>();
            try
            {
                action.Data = new ShipingInfo() { IsPrintCustomerLabel= IsPrintCustomerLabel,ShipQty = Context["CurShipQty"].ToInt32() };
            }
            catch (Exception ex)
            {
                action.CatchExceptionWithLog(ex, $"包装工序:获取是否打印客户标签还是入库标签异常");
            }
            return action;
        }
        #endregion Functions
        /// <summary>