cjs
6 天以前 648f4270f4f56c5ca284dbcfa650de05e46a7052
HH.WCS.Mobox3.NongFuLinZhi/process/TaskProcess.cs
@@ -1477,7 +1477,7 @@
                                        LogHelper.Info($"出库算法04:当前货位绑定的托盘码为:{cntrInfo.S_CNTR_CODE}");
                                        string endItemCode = "";
                                        var itemInfo = db.Queryable<CntrItemRel>().Where(b => b.S_CNTR_CODE == cntrInfo.S_CNTR_CODE).First();
                                        if (itemInfo != null && itemInfo.S_ITEM_CODE == itemCode)
                                        if (itemInfo != null)
                                        {
                                            endItemCode = itemInfo.S_ITEM_CODE;
                                        }
@@ -1946,24 +1946,7 @@
                    {
                        var cir = new LocCntrRel { S_LOC_CODE = loc, S_CNTR_CODE = cntrCode, S_SRC = deviceName };
                        if (db.Insertable<LocCntrRel>(cir).ExecuteCommand() > 0) LogHelper.Info($"货位容器表绑定成功,货位号:{loc},托盘号:{cntrCode}");
                        var Con = db.Queryable<Container>().Where(a => a.S_CODE == cntrCode).First();
                        if(Con == null)
                        {
                            int detallCount = 0;
                            if (!string.IsNullOrEmpty(itemCode))
                            {
                                detallCount = 1;
                            }
                            if(db.Insertable<Container>(new Container
                            {
                                S_CODE = cntrCode,
                                N_TYPE = 1,
                                N_DETAIL_COUNT = detallCount
                            }).ExecuteCommand() > 0)
                            {
                                LogHelper.Info($"容器表绑定成功,托盘号:{cntrCode}");
                            }
                        }
                        if (!string.IsNullOrEmpty(itemCode))
                        {
                            BindCntrItem(cntrCode, itemCode, batchNo, itemlayer, itemName);
@@ -1990,6 +1973,26 @@
            try
            {
                db.BeginTran();
                var Con = db.Queryable<Container>().Where(a => a.S_CODE == trayCode).First();
                if (Con == null)
                {
                    int detallCount = 1;
                    if (db.Insertable<Container>(new Container
                    {
                        S_CODE = trayCode,
                        N_TYPE = 1,
                        N_DETAIL_COUNT = detallCount
                    }).ExecuteCommand() > 0)
                    {
                        LogHelper.Info($"容器表绑定成功,托盘号:{trayCode}");
                    }
                }
                else
                {
                    Con.N_DETAIL_COUNT = 1;
                    db.Updateable(Con).UpdateColumns(a => new { a.N_DETAIL_COUNT }).ExecuteCommand();
                }
                //db.Updateable(cntr).UpdateColumns(it => new { it.S_DEST }).ExecuteCommand();
                //1.将原有容器物料信息删除
                //db.Deleteable<CntrItemRel>().Where(it => it.S_CNTR_CODE == cntr.S_CNTR_CODE.Trim()).ExecuteCommand();
@@ -2548,23 +2551,8 @@
            var op = WMSHelper.GetWmsTask(TN_Task.S_OP_CODE);
            if (op != null)
            {
                if (op.N_B_STATE == 0)
                {
                    //等待直接修改状态为取消
                    op.N_B_STATE = 3;
                }
                else if (op.N_B_STATE == 1)
                {
                    if (WCSHelper.CheckActionRecordExist(TN_Task.S_CODE, 4))
                    {
                        op.N_B_STATE = 2;
                    }
                    else
                    {
                        op.N_B_STATE = 3;
                    }
                }
                op.N_B_STATE = 2;
                WMSHelper.UpdateTaskState(op);
            }
            NDCApi.CancelOrder(TN_Task.S_CODE.Trim());