| | |
| | | var startLocCode = prod.OffLoc[0]; // 用于测试 |
| | | //var startLocCode = "CX01"; // 用于测试 |
| | | |
| | | //var cgDetail = new TN_CG_Detail { // 空托上线时就绑定好了 |
| | | // S_ITEM_CODE = itemCode, |
| | | // S_BATCH_NO = batchNo, |
| | | // S_CNTR_CODE = cntrCode, |
| | | //}; |
| | | |
| | | //var needInsertContainer = false; |
| | | //var needUpdateContainer = false; |
| | | |
| | | // TEMP 自动触发的托盘下线暂时不考虑判断,默认没有时写入 |
| | | // 查容器信息表是否已经有这个容器 |
| | | //var cntr = db.Queryable<TN_Container>() |
| | | // .Where(c => c.S_CODE == cntrCode).First(); |
| | | // 如果找不到该容器,需要添加,并且将容器来源设置为任务名称 |
| | | //if (cntr == null) { |
| | | // needInsertContainer = true; |
| | | // LogHelper.Info($"轮询:{taskName}:容器:{cntrCode},在容器表中没有登记,登记并设置容器来源为:{taskName}"); |
| | | |
| | | // cntr = new TN_Container { |
| | | // S_CODE = cntrCode, |
| | | // S_TYPE = cntrType, |
| | | // S_SPEC = itemCode, |
| | | // }; |
| | | //} |
| | | //else { |
| | | // 如果找到该容器,但容器物料类型与下线物料不符,记录并直接覆盖(待定) |
| | | // if (!string.IsNullOrEmpty(cntr.S_SPEC) && cntr.S_SPEC != itemCode) { |
| | | // needUpdateContainer = true; |
| | | // LogHelper.Info($"轮询:{taskName}:容器表中容器{cntrCode}对应的物料信息:{cntr.S_SPEC}," + |
| | | // $"与所需要的物料信息{itemCode}不符,直接覆盖结果"); |
| | | |
| | | // cntr.S_SPEC = itemCode; |
| | | // } |
| | | //} |
| | | |
| | | var startLoc = db.Queryable<TN_Location>() |
| | | .Where(l => l.S_CODE == startLocCode) |
| | | .Where(l => Settings.AreaMap[startAreaName].Contains(l.S_AREA_CODE)) |
| | |
| | | LocationHelper.LockStartLoc(ref startLoc); // 起点出库锁 |
| | | LocationHelper.LockEndLoc(ref endLoc); // 终点入库锁 |
| | | |
| | | //cntr.S_SOURCE = task.S_CODE; |
| | | //cntr.T_MODIFY = DateTime.Now; |
| | | |
| | | using (var tran = db.Ado.UseTran()) { |
| | | if (locCntrRelOld != null) { |
| | | if (db.Deleteable<TN_Loc_Container>(locCntrRelOld).ExecuteCommand() <= 0 && |
| | |
| | | continue; |
| | | } |
| | | } |
| | | //if (needInsertContainer) { |
| | | // if (db.Insertable<TN_Container>(cntr).ExecuteCommand() <= 0) { |
| | | // info = $"插入容器表失败:" + JsonConvert.SerializeObject(cntr); |
| | | // tran.RollbackTran(); |
| | | // LogHelper.Info(info); |
| | | // continue; |
| | | // } |
| | | //} |
| | | //else if (needUpdateContainer) { |
| | | // if (db.Updateable<TN_Container>(cntr) |
| | | // .UpdateColumns(c => new { c.S_SPEC, c.S_SOURCE, c.T_MODIFY }).ExecuteCommand() <= 0) { |
| | | // info = $"更新容器表失败:" + JsonConvert.SerializeObject(cntr); |
| | | // tran.RollbackTran(); |
| | | // LogHelper.Info(info); |
| | | // continue; |
| | | // } |
| | | //} |
| | | |
| | | //if (db.Insertable<TN_CG_Detail>(cgDetail).ExecuteCommand() <= 0) { |
| | | // tran.RollbackTran(); |
| | | // info = $"插入容器货品信息表失败:物料编码{cgDetail.S_ITEM_CODE},容器编码{cgDetail.S_CNTR_CODE}"; |
| | | // LogHelper.Info(info); |
| | | // continue; |
| | | //} |
| | | |
| | | if (db.Insertable<TN_Loc_Container>(locCntrRel).ExecuteCommand() <= 0) { |
| | | tran.RollbackTran(); |
| | |
| | | LogHelper.Info(info); |
| | | continue; |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | |