| | |
| | | using System.Security.Policy; |
| | | using HH.WCS.Mobox3.pinggao.models; |
| | | using static HH.WCS.Mobox3.pinggao.wms.WMSHelper; |
| | | using WHTest; |
| | | using System.Net; |
| | | using SqlSugar; |
| | | using static HH.WCS.Mobox3.pinggao.models.SapRoot.GYSDto; |
| | |
| | | |
| | | result.resultCode = 1; |
| | | result.resultMsg = $"物料{a.WLBM}物料主数据不存在该物料"; |
| | | result.resultMsg = "失败"; |
| | | result.WLPZBH = itemwlpz.HEAD.WLPZH; |
| | | result.WLPZND = itemwlpz.HEAD.ND; |
| | | simpleResults.Add(result); |
| | | continue; |
| | | /* throw new Exception($"物料{a.WLH}物料主数据不存在该物料")*/ |
| | | ; |
| | |
| | | } |
| | | } |
| | | } |
| | | result.resultMsg = "成功"; |
| | | result.WLPZBH = itemwlpz.HEAD.WLPZH; |
| | | result.WLPZND = itemwlpz.HEAD.ND; |
| | | result.resultCode = 0; |
| | | result.resultMsg = ""; |
| | | simpleResults.Add(result); |
| | | |
| | | var result2 = new SimpleResult(); |
| | | result2.resultMsg = "成功"; |
| | | result2.WLPZBH = itemwlpz.HEAD.WLPZH; |
| | | result2.WLPZND = itemwlpz.HEAD.ND; |
| | | result2.resultCode = 0; |
| | | simpleResults.Add(result2); |
| | | db.CommitTran(); |
| | | } |
| | | } |
| | |
| | | result.resultMsg = "成功"; |
| | | result.resultCode = 0; |
| | | //校验入库单数量,不可以超,成功后插入托盘物料表,更新入库单累计数量 |
| | | result = AddInboundOrder(model.MaterList, model.cntr_code); |
| | | result = AddInboundOrder(model.MaterList, model.cntr_code,model.cntr_type); |
| | | #region MyRegion |
| | | |
| | | |
| | |
| | | } |
| | | |
| | | //通用接口 对容器货品的删减 和生成回库单 都要用的接口 |
| | | result = await TYAddOutboundOrder(db, model.MaterList, model.arrival_no, model.cntr_code, model.IsHK, model.start, po.S_OUT_TYPE); |
| | | result = await TYAddOutboundOrder(db, model.MaterList, model.arrival_no, model.cntr_code, model.IsHK, model.start, po.S_OUT_TYPE,model.cntr_type); |
| | | if (result.resultCode==1) |
| | | { |
| | | return result; |
| | | } |
| | | #region 升降量 |
| | | |
| | | bool adds = true; |
| | |
| | | LogHelper.Info($"mobox 库区降量接口返回为空"); |
| | | |
| | | } |
| | | if (adds) addOnShelves(po, model.cntr_code, 2); |
| | | //if (adds) addOnShelves(po, model.cntr_code, 2); |
| | | |
| | | } |
| | | else LogHelper.Info($"托盘{model.cntr_code}无需要升降量的物料"); |
| | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | LogHelper.Info($"报错{e.Message}"); |
| | | result.resultMsg = e.Message; |
| | | db.RollbackTran(); |
| | | return result; |
| | |
| | | } |
| | | |
| | | } |
| | | public static async Task<SimpleResult> TYAddOutboundOrder(SqlSugarClient db, List<Mater> MaterList, string arrival_no, string cntr_code, bool isHK, string start, string S_OUT_TYPE) |
| | | public static async Task<SimpleResult> TYAddOutboundOrder(SqlSugarClient db, List<Mater> MaterList, string arrival_no, string cntr_code, bool isHK, string start, string S_OUT_TYPE,string cntr_type) |
| | | { |
| | | // var db = new SqlHelper<object>().GetInstance(); |
| | | //using (var db = new SqlHelper<object>().GetInstance()) |
| | |
| | | if (cir != null) |
| | | { |
| | | cir.F_QTY -= item.qty; |
| | | cir.S_CNTR_TYPE = cntr_type; |
| | | cir.F_ALLOC_QTY -= item.qty; |
| | | cir.T_MODIFY = DateTime.Now; |
| | | if (cir.F_QTY == 0) |
| | |
| | | } |
| | | else |
| | | { |
| | | db.Updateable(cir).UpdateColumns(it => new { it.F_QTY, it.F_ALLOC_QTY, it.T_MODIFY }).ExecuteCommand(); |
| | | db.Updateable(cir).UpdateColumns(it => new { it.F_QTY,it.S_CNTR_TYPE, it.F_ALLOC_QTY, it.T_MODIFY }).ExecuteCommand(); |
| | | //添加回库作业 |
| | | |
| | | |
| | | } |
| | | } |
| | | else |
| | |
| | | LogHelper.Info($"物料不存在{item.item_code}"); |
| | | return result; |
| | | } |
| | | if (isHK) |
| | | { |
| | | var wmsTask = new WMSTask |
| | | { |
| | | S_CNTR_CODE = cntr_code, |
| | | S_CODE = WMSHelper.GenerateTaskNo(), |
| | | S_START_LOC = start, |
| | | S_START_AREA = startinfo.S_AREA_CODE, |
| | | S_START_WH = startinfo.S_WH_CODE, |
| | | S_END_LOC = startinfo.S_CODE, |
| | | S_END_AREA = startinfo.S_AREA_CODE, |
| | | S_END_WH = startinfo.S_WH_CODE, |
| | | |
| | | N_TYPE = 1, |
| | | // S_TYPE = WMSTask.GetTypeStr(1), |
| | | S_TYPE = "回库", |
| | | S_OP_DEF_CODE = "", |
| | | S_OP_DEF_NAME = "pda入库" |
| | | }; |
| | | if (WMSHelper.CreateWmsTask(wmsTask)) |
| | | { |
| | | LocationHelper.LockLoc(start, 1); |
| | | result.resultMsg = $"创建作业成功,作业号{wmsTask.S_CODE}"; |
| | | } |
| | | } |
| | | |
| | | OutboundRecord outboundRecord = new OutboundRecord(); |
| | | outboundRecord.S_WLPZBH = pz?.S_WLPZBH; |
| | | outboundRecord.S_WLPZND = pz?.S_WLPZND; |
| | |
| | | return result; |
| | | } |
| | | } |
| | | db.Insertable<OutboundRecord>(records).ExecuteCommand(); |
| | | if (isHK) |
| | | { |
| | | var locs= db.Queryable<WCSTask>().Where(a =>a.S_TYPE.Contains("出库")&& a.S_CNTR_CODE == cntr_code&&a.N_B_STATE==3).OrderByDescending(s=>s.T_END_TIME).First(); |
| | | if (locs!=null) |
| | | { |
| | | var cntr= db.Queryable<TN_Distribution_CNTR>().Where(a => a.S_DC_NO== locs.S_BS_NO).First(); |
| | | if (cntr!=null) |
| | | { |
| | | cntr.S_SORT_TYPE = "已分拣"; |
| | | db.Updateable(cntr).UpdateColumns(it => new { it.S_SORT_TYPE }).ExecuteCommand(); |
| | | } |
| | | else |
| | | { |
| | | result.resultCode = 1; |
| | | result.resultMsg += $"任务{locs.S_CODE}来源号{locs.S_BS_NO}找不到配盘信息"; |
| | | return result; |
| | | } |
| | | //var location = db.Queryable<Location>().Where(a => a.S_CODE == locs.S_LOC_CODE).First(); |
| | | var wmsTask = new WMSTask |
| | | { |
| | | S_CNTR_CODE = cntr_code, |
| | | S_CODE = WMSHelper.GenerateTaskNo(), |
| | | S_START_LOC = start, |
| | | S_START_AREA = startinfo.S_AREA_CODE, |
| | | S_START_WH = startinfo.S_WH_CODE, |
| | | S_END_LOC = locs?.S_START_LOC, |
| | | S_END_AREA = locs?.S_START_AREA, |
| | | S_END_WH = locs?.S_START_WH, |
| | | |
| | | N_TYPE = 1, |
| | | // S_TYPE = WMSTask.GetTypeStr(1), |
| | | S_TYPE = "回库", |
| | | S_OP_DEF_CODE = "", |
| | | S_OP_DEF_NAME = "pda入库" |
| | | }; |
| | | if (WMSHelper.CreateWmsTask(wmsTask)) |
| | | { |
| | | LocationHelper.LockLoc(start, 1); |
| | | result.resultMsg = $"创建作业成功,作业号{wmsTask.S_CODE}"; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | result.resultCode = 1; |
| | | result.resultMsg += $"找不到容器对应任务信息{cntr_code}"; |
| | | return result; |
| | | } |
| | | |
| | | } |
| | | var sss= db.Insertable<OutboundRecord>(records).ExecuteCommand(); |
| | | |
| | | //db.CommitTran(); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | //db.RollbackTran(); |
| | | LogHelper.Info("物料信息绑定到满容器上" + ex.Message); |
| | | result.resultCode = 1; |
| | | result.resultMsg += ex.Message; |
| | | Console.WriteLine(ex.Message); |
| | | |
| | | throw; |
| | |
| | | /// <param name="cntr_code"></param> |
| | | /// <returns></returns> |
| | | [ApiExplorerSettings(IgnoreApi = true)] |
| | | public static SimpleResult AddInboundOrder(List<Mater> MaterList, string cntr_code) |
| | | public static SimpleResult AddInboundOrder(List<Mater> MaterList, string cntr_code,string S_CNTR_TYPE) |
| | | { |
| | | var result = new SimpleResult(); |
| | | // var db = new SqlHelper<object>().GetInstance(); |
| | |
| | | if (cir != null) |
| | | { |
| | | cir.F_QTY += item.qty; |
| | | db.Updateable(cir).UpdateColumns(it => new { it.F_QTY }).ExecuteCommand(); |
| | | cir.S_CNTR_TYPE = S_CNTR_TYPE; |
| | | db.Updateable(cir).UpdateColumns(it => new { it.F_QTY,it.S_CNTR_TYPE }).ExecuteCommand(); |
| | | } |
| | | else |
| | | { |
| | | //2.插入新的容器物料信息(容器号不变S_SERIAL_NO = item.S_SERIAL_NO,) |
| | | cir = new CntrItemRel { S_CNTR_CODE = cntr.S_CODE.Trim(), S_UOM = info.S_UOM, S_BATCH_NO = item.S_BATCH_NO, N_BS_ROW_NO = item.N_ROW_NO, F_QTY = item.qty, S_ITEM_CODE = item.item_code, S_BS_NO = item.arrival_no }; |
| | | cir = new CntrItemRel { S_CNTR_TYPE= S_CNTR_TYPE, S_CNTR_CODE = cntr.S_CODE.Trim(), S_UOM = info.S_UOM, S_BATCH_NO = item.S_BATCH_NO, N_BS_ROW_NO = item.N_ROW_NO, F_QTY = item.qty, S_ITEM_CODE = item.item_code, S_BS_NO = item.arrival_no }; |
| | | db.Insertable<CntrItemRel>(cir).ExecuteCommand(); |
| | | } |
| | | var count = db.Queryable<CntrItemRel>().Count(a => a.S_CNTR_CODE == cntr.S_CODE); |
| | |
| | | // 准备请求参数 |
| | | ZscmNc request = new ZscmNc(); |
| | | request.Input = "<?xml version=\"1.0\" encoding=\"utf-8\" ?>" + xml; |
| | | LogHelper.Info($"内采SAP回调"); |
| | | LogHelper.Info($"内采SAP回调{service.Url}"); |
| | | // 调用Web Service |
| | | ZscmNcResponse responses = service.ZscmNc(request); |
| | | |