| | |
| | | |
| | | using HH.WCS.JiaTong.models.other; |
| | | using HH.WCS.JiaTong.util; |
| | | using SqlSugar; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | |
| | | /// <summary> |
| | | /// 创建托盘物料绑定关系 |
| | | /// </summary> |
| | | /// <param name="loc"></param> |
| | | /// <param name="cntr"></param> |
| | | /// <param name="itemcode"></param> |
| | | /// <param name="loc">货位</param> |
| | | /// <param name="cntr">托盘</param> |
| | | /// <param name="itemcode">物料编码</param> |
| | | /// <param name="itemname">物料名称</param> |
| | | /// <param name="itemtype">物料类型</param> |
| | | /// <param name="cntrtype">托盘类型</param> |
| | | /// <param name="batch">批次号</param> |
| | | /// <param name="wmslot">wms内部批次号,转发</param> |
| | | /// <param name="weight">重量</param> |
| | | /// <param name="unit">单位</param> |
| | | /// <param name="level">物料等级</param> |
| | | /// <param name="tyreType">轮型</param> |
| | | /// <param name="supplier">供应商</param> |
| | | /// <param name="receiveLot">收获批次</param> |
| | | /// <param name="subpool">子库</param> |
| | | /// <param name="expData">生产时间</param> |
| | | /// <param name="prdData">到期时间</param> |
| | | /// <returns></returns> |
| | | internal static bool CreateCntrItem(string loc, string cntr, string itemcode, string itemname, string itemtype, string cntrtype, string batch, string weight, string unit, string level = "") |
| | | internal static bool CreateCntrItem(string loc, string cntr, string itemcode, string itemname, string itemtype, string cntrtype, |
| | | string batch, string wmslot, string weight, string unit, string tyreType, string supplier, string receiveLot, string subpool, string expData = "", string prdData = "", string level = "",int qty =0, int qtycfg = 0) |
| | | { |
| | | var res = false; |
| | | var db = new SqlHelper<object>().GetInstance(); |
| | |
| | | db.Insertable<Container>(container).ExecuteCommand(); |
| | | } |
| | | var cntritem = db.Queryable<CntrItemDetail>().Where(a => a.S_CNTR_CODE.Trim() == cntr).First(); |
| | | string[] kts = new string[] { "TP", "KT" }; |
| | | if (cntritem == null && !kts.Contains(itemcode)) |
| | | // string[] kts = new string[] { "TP", "KT" }; |
| | | if (cntritem == null) |
| | | { |
| | | var iteminfo = db.Queryable<TN_Material>().Where(a => a.S_ITEM_CODE.Trim() == itemcode && a.S_ITEM_NAME.Trim() == itemname).First(); |
| | | var cir = new CntrItemDetail { S_CNTR_CODE = cntr, S_ITEM_CODE = itemcode, S_ITEM_NAME = itemname, S_ITEM_SPEC = itemtype, S_WU = unit, F_WEIGHT = weight, S_BATCH_NO = batch, LEV = level }; |
| | | var cir = new CntrItemDetail |
| | | { |
| | | S_CNTR_CODE = cntr, |
| | | S_ITEM_CODE = itemcode, |
| | | S_ITEM_NAME = itemname, |
| | | S_ITEM_SPEC = itemtype, |
| | | S_WU = unit, |
| | | F_WEIGHT = weight, |
| | | S_BATCH_NO = batch, |
| | | WmsLot = wmslot, |
| | | LEV = level, |
| | | TyreType = tyreType, |
| | | S_SUPPLIER_NO = supplier, |
| | | ReceiveLot = receiveLot, |
| | | Subpool = subpool, |
| | | D_EXP_DATE = prdData, |
| | | D_PRD_DATE = expData, |
| | | F_WEIGHT1= qty.ToString(), |
| | | F_QTY1= qtycfg.ToString() |
| | | }; |
| | | db.Insertable<CntrItemDetail>(cir).ExecuteCommand(); |
| | | } |
| | | var cntrloc = db.Queryable<LocCntrRel>().Where(a => a.S_CNTR_CODE.Trim() == cntr).First(); |
| | | else |
| | | { |
| | | cntritem.S_ITEM_CODE = itemcode; |
| | | cntritem.S_ITEM_NAME = itemname; |
| | | cntritem.S_ITEM_SPEC = itemtype; |
| | | cntritem.F_WEIGHT = weight; |
| | | cntritem.S_BATCH_NO = batch; |
| | | cntritem.S_WU = unit; |
| | | cntritem.F_WEIGHT = weight; |
| | | cntritem.WmsLot = wmslot; |
| | | cntritem.LEV = level; |
| | | cntritem.TyreType = tyreType; |
| | | cntritem.S_SUPPLIER_NO = supplier; |
| | | cntritem.ReceiveLot = receiveLot; |
| | | cntritem.Subpool = subpool; |
| | | cntritem.D_EXP_DATE = prdData; |
| | | cntritem.D_PRD_DATE = expData; |
| | | cntritem. F_WEIGHT1 = qty.ToString(); |
| | | cntritem. F_QTY1 = qtycfg.ToString(); |
| | | if (db.Updateable<CntrItemDetail>(cntritem).ExecuteCommand() > 0) |
| | | { |
| | | LogHelper.Info($"托盘{cntr}:更新物料{itemcode}绑定关系成功"); |
| | | res = true; |
| | | } |
| | | } |
| | | var cntrloc = db.Queryable<LocCntrRel>().Where(a => a.S_CNTR_CODE.Trim() == cntr).First(); |
| | | if (cntrloc == null) |
| | | { |
| | | var loctp = new LocCntrRel { S_LOC_CODE = loc, S_CNTR_CODE = cntr }; |
| | |
| | | /// <summary> |
| | | /// 创建托盘物料绑定关系 |
| | | /// </summary> |
| | | /// <param name="loc"></param> |
| | | /// <param name="cntr"></param> |
| | | /// <param name="itemcode"></param> |
| | | /// <param name="cntr">托盘号</param> |
| | | /// <param name="itemcode">物料编码</param> |
| | | /// <param name="itemname">物料名称</param> |
| | | /// <param name="batch">批次号</param> |
| | | /// <param name="weight">重量</param> |
| | | /// <param name="qty">数量</param> |
| | | /// <param name="expData">生产时间</param> |
| | | /// <param name="prdData">到期时间</param> |
| | | /// <returns></returns> |
| | | internal static bool CreateCntrItem(string cntr, string itemcode, string itemname, string batch, string weight) |
| | | internal static bool CreateCntrItem(string cntr, string itemcode, string itemname, string batch, string weight, int qty, string expData = "", string prdData = "") |
| | | { |
| | | var res = false; |
| | | var db = new SqlHelper<object>().GetInstance(); |
| | |
| | | var cntritem = db.Queryable<CntrItemDetail>().Where(a => a.S_CNTR_CODE.Trim() == cntr).First(); |
| | | if (cntritem == null) |
| | | { |
| | | |
| | | var cir = new CntrItemDetail { S_CNTR_CODE = cntr, S_ITEM_CODE = itemcode, S_ITEM_NAME = itemname, F_WEIGHT = weight, S_BATCH_NO = batch }; |
| | | |
| | | var cir = new CntrItemDetail |
| | | { |
| | | S_CNTR_CODE = cntr, |
| | | S_ITEM_CODE = itemcode, |
| | | S_ITEM_NAME = itemname, |
| | | F_WEIGHT = weight, |
| | | S_BATCH_NO = batch, |
| | | F_QTY = qty, |
| | | D_EXP_DATE = prdData, |
| | | D_PRD_DATE = expData |
| | | }; |
| | | if (db.Insertable<CntrItemDetail>(cir).ExecuteCommand() > 0) |
| | | { |
| | | LogHelper.Info($"托盘{cntr}:添加物料{itemcode}绑定关系成功"); |
| | |
| | | else |
| | | { |
| | | LogHelper.Info($"托盘{cntr}:添加物料{itemcode}绑定关系失败"); |
| | | res = false; |
| | | } |
| | | |
| | | } |
| | |
| | | cntritem.S_ITEM_NAME = itemname; |
| | | cntritem.F_WEIGHT = weight; |
| | | cntritem.S_BATCH_NO = batch; |
| | | |
| | | cntritem.D_EXP_DATE = prdData; |
| | | cntritem.D_PRD_DATE = expData; |
| | | |
| | | if (db.Updateable<CntrItemDetail>(cntritem).ExecuteCommand() > 0) |
| | | { |
| | | LogHelper.Info($"托盘{cntr}:更新物料{itemcode}绑定关系成功"); |
| | |
| | | else |
| | | { |
| | | LogHelper.Info($"托盘{cntr}:更新物料{itemcode}绑定关系失败"); |
| | | res = false; |
| | | } |
| | | } |
| | | var con = db.Queryable<Container>().Where(a => a.S_CODE.Trim() == cntr).First(); |
| | |
| | | db.Insertable<Container>(container).ExecuteCommand(); |
| | | } |
| | | db.Ado.CommitTran(); |
| | | |
| | | |
| | | } |
| | | catch (Exception ex) |
| | | { |