| | |
| | | |
| | | } |
| | | |
| | | public static bool MaterPanduan(string ItemCode,double count) { |
| | | bool panduan = true; |
| | | var db = new SqlHelper<object>().GetInstance(); |
| | | |
| | | var po = db.Queryable<TN_Material_KC>().Where(a => a.S_ITEM_CODE == ItemCode).First(); |
| | | |
| | | var po1 = db.Queryable<CntrItemRel>().Where(a => a.S_ITEM_CODE == ItemCode).First(); |
| | | if (po != null) |
| | | { |
| | | if (po1!=null) |
| | | { |
| | | double sl= po1.F_QTY + count; |
| | | if (sl>po.N_COUNT) |
| | | { |
| | | panduan = false; |
| | | } |
| | | } |
| | | if (count > po.N_COUNT) |
| | | { |
| | | panduan = false; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | panduan = false; |
| | | } |
| | | return panduan; |
| | | } |
| | | /// <summary> |
| | | /// 数据 |
| | | /// </summary> |
| | |
| | | } |
| | | foreach (var item in items.ITEM) |
| | | { |
| | | //bool v= MaterPanduan(item.WLBM, item.SL); |
| | | // if (!v) |
| | | // { |
| | | // result.resultMsg = "失败"; |
| | | // result.WLPZBH = items.HEAD.WLPZH; |
| | | // result.resultCode = 1; |
| | | // result.WLPZND = items.HEAD.WLPZND; |
| | | // result.resultMsg = $"物料{item.WLBM}数量超过 库存总数"; |
| | | // simpleResults.Add(result); |
| | | // continue; |
| | | // } |
| | | ///判断是否都有冲销凭证编号 |
| | | if (string.IsNullOrEmpty(item.CXPZH)) |
| | | { |
| | |
| | | return result; |
| | | } |
| | | //判断托盘是否已经生成任务,如果没有则生成 |
| | | var wmsTaskcs = WMSHelper.GetWmsTaskByCntr(model.cntr_code); |
| | | if (wmsTaskcs != null) |
| | | if (!string.IsNullOrEmpty(model.cntr_code)) |
| | | { |
| | | result.resultCode = 3; |
| | | result.resultMsg = $"起点{model.start} 托盘{model.cntr_code}已经创建任务,请勿重复申请"; |
| | | return result; |
| | | var wmsTaskcs = WMSHelper.GetWmsTaskByCntr(model.cntr_code); |
| | | if (wmsTaskcs != null) |
| | | { |
| | | result.resultCode = 3; |
| | | result.resultMsg = $"起点{model.start} 托盘{model.cntr_code}已经创建任务,请勿重复申请"; |
| | | return result; |
| | | } |
| | | } |
| | | |
| | | //出库 |
| | | if (model.Type==2) |
| | | { |
| | |
| | | { |
| | | start= db.Queryable<Location>().Where(it => it.S_CODE == loc.S_LOC_CODE).First(); |
| | | } |
| | | } |
| | | else if (!string.IsNullOrEmpty(model.item_code)) |
| | | { |
| | | start = db.Queryable<LocCntrRel>() |
| | | .LeftJoin<CntrItemRel>((lcr, cir) => lcr.S_CNTR_CODE == cir.S_CNTR_CODE&&cir.S_CNTR_TYPE=="半托") |
| | | .Where((lcr, cir) => cir.S_CNTR_CODE != null) |
| | | .LeftJoin<Location>((lcr, cir, loc) => lcr.S_LOC_CODE == loc.S_CODE && loc.S_AREA_CODE == "HJQ") |
| | | .Select((lcr, cir, loc) => loc).ToList() // 返回 Location 对象 |
| | | .FirstOrDefault(); // 或者 Take(1).ToList()[0] |
| | | } |
| | | else |
| | | { |
| | |
| | | start = db.Queryable<LocCntrRel>() |
| | | .LeftJoin<CntrItemRel>((lcr, cir) => lcr.S_CNTR_CODE == cir.S_CNTR_CODE) |
| | | .Where((lcr, cir) => cir.S_CNTR_CODE == null) // 找出未被占用的容器 |
| | | .LeftJoin<Location>((lcr, cir, loc) => lcr.S_LOC_CODE == loc.S_CODE&&loc.S_AREA_CODE== "HJQ") |
| | | .LeftJoin<Location>((lcr, cir, loc) => lcr.S_LOC_CODE == loc.S_CODE && loc.S_AREA_CODE == "HJQ") |
| | | .Select((lcr, cir, loc) => loc).ToList() // 返回 Location 对象 |
| | | .FirstOrDefault(); // 或者 Take(1).ToList()[0] |
| | | } |
| | |
| | | Location end = new Location(); |
| | | if (!string.IsNullOrEmpty(model.cntr_code)) |
| | | { |
| | | |
| | | #region MyRegion |
| | | //var list = db.Queryable<CntrItemRel>().Select(s => s.S_CNTR_CODE).ToArray(); |
| | | //var S_LOC_CODElist = db.Queryable<LocCntrRel>().Where(s=>!list.Contains(s.S_CNTR_CODE)).Select(s=>s.S_LOC_CODE).ToArray(); |