| | |
| | | string sql = $"/*dialect*/update t1 set t1.FHLockedSub=1 from Sc_WorkBillSortBillSub t1 join Sc_WorkBillSortBillMain t2 on t1.FID = t2.FID where FHMASTERDATE between DATEADD(day,-1,getdate()) and DATEADD(day,{day - 1},getdate())"; |
| | | sqlList.Add(sql); |
| | | int result = DBServiceHelper.ExecuteBatch(Context, sqlList); |
| | | //if (result > 0) |
| | | //{ |
| | | //锁定后生成日计划用料清单 及 提料计划 |
| | | DayPlanPPBomBill(); |
| | | //Extraction(); |
| | | //SearchList(); |
| | | |
| | | //} |
| | | //else |
| | | // this.View.ShowMessage("操作失败,联系管理员!"); |
| | | } |
| | | /// <summary> |
| | | /// 解锁 |
| | |
| | | } |
| | | foreach (DynamicObject current in entityDataObjoct) |
| | | { |
| | | JObject jsonRoot = new JObject(); |
| | | jsonRoot.Add("Creator", ""); |
| | | jsonRoot.Add("NeedUpDateFields", new JArray()); |
| | | jsonRoot.Add("NeedReturnFields", new JArray()); |
| | | jsonRoot.Add("IsDeleteEntry", "false"); |
| | | jsonRoot.Add("SubSystemId", ""); |
| | | jsonRoot.Add("IsVerifyBaseDataField", ""); |
| | | JObject jsonModel = new JObject(); |
| | | jsonModel.Add("FID", Convert.ToString(current["FDayPlanWorkID"])); |
| | | jsonModel.Add("FOrderQuantity", Convert.ToString(current["FOrderQuantity"])); |
| | | jsonModel.Add("FDayPlanQuantity", Convert.ToDecimal(current["FDayPlanQuantity"]) + Convert.ToDecimal(current["FQTYLS"])); |
| | | jsonModel.Add("FNoScheduled", Convert.ToString(current["FNoScheduled"])); |
| | | sql = $" /*dialect*/ select FEntryID, FHMASTERDATE from SC_WORKBILLSORTBILLSub where FID={Convert.ToString(current["FDayPlanWorkID"])} "; |
| | | List<DayPlanModel> dayPlanModel = new List<DayPlanModel>(); |
| | | dayPlanModel = DBServiceHelper.ExecuteDataSet(Context, sql).ToModelList<DayPlanModel>(); |
| | | JArray Entry = new JArray(); |
| | | for (int i = 0; i <= 60; i++) |
| | | if (Convert.ToInt32(current["FDayPlanWorkID"]) > 0) |
| | | { |
| | | if (Convert.ToString(current["FT" + "" + i + ""]) == "" || Convert.ToString(current["FT" + "" + i + ""]) == "0") |
| | | continue; |
| | | JObject jsonFPOOrderEntry = new JObject(); |
| | | jsonFPOOrderEntry.Add("FHMasterDate", date.AddDays(i).ToShortDateString()); ;//主日期 |
| | | jsonFPOOrderEntry.Add("FHQty ", Convert.ToString(current["FT" + "" + i + ""])); ;//日计划数量 |
| | | List<DayPlanModel> _dayPlanModel = dayPlanModel.Where(x => x.FHMASTERDATE == date.AddDays(i)).ToList(); |
| | | if (_dayPlanModel.Count > 0) |
| | | JObject jsonRoot = new JObject(); |
| | | jsonRoot.Add("Creator", ""); |
| | | jsonRoot.Add("NeedUpDateFields", new JArray()); |
| | | jsonRoot.Add("NeedReturnFields", new JArray()); |
| | | jsonRoot.Add("IsDeleteEntry", "false"); |
| | | jsonRoot.Add("SubSystemId", ""); |
| | | jsonRoot.Add("IsVerifyBaseDataField", ""); |
| | | JObject jsonModel = new JObject(); |
| | | jsonModel.Add("FID", Convert.ToString(current["FDayPlanWorkID"])); |
| | | jsonModel.Add("FOrderQuantity", Convert.ToString(current["FOrderQuantity"])); |
| | | jsonModel.Add("FDayPlanQuantity", Convert.ToDecimal(current["FDayPlanQuantity"]) + Convert.ToDecimal(current["FQTYLS"])); |
| | | jsonModel.Add("FNoScheduled", Convert.ToString(current["FNoScheduled"])); |
| | | sql = $" /*dialect*/ select FEntryID, FHMASTERDATE from SC_WORKBILLSORTBILLSub where FID={Convert.ToString(current["FDayPlanWorkID"])} "; |
| | | List<DayPlanModel> dayPlanModel = new List<DayPlanModel>(); |
| | | dayPlanModel = DBServiceHelper.ExecuteDataSet(Context, sql).ToModelList<DayPlanModel>(); |
| | | JArray Entry = new JArray(); |
| | | for (int i = 0; i <= 60; i++) |
| | | { |
| | | jsonFPOOrderEntry.Add("FEntryID", _dayPlanModel.FirstOrDefault().FEntryID); ;//序号 |
| | | if (Convert.ToString(current["FT" + "" + i + ""]) == "" || Convert.ToString(current["FT" + "" + i + ""]) == "0") |
| | | continue; |
| | | JObject jsonFPOOrderEntry = new JObject(); |
| | | jsonFPOOrderEntry.Add("FHMasterDate", date.AddDays(i).ToShortDateString()); ;//主日期 |
| | | jsonFPOOrderEntry.Add("FHQty ", Convert.ToString(current["FT" + "" + i + ""])); ;//日计划数量 |
| | | List<DayPlanModel> _dayPlanModel = dayPlanModel.Where(x => x.FHMASTERDATE == date.AddDays(i)).ToList(); |
| | | if (_dayPlanModel.Count > 0) |
| | | { |
| | | jsonFPOOrderEntry.Add("FEntryID", _dayPlanModel.FirstOrDefault().FEntryID); ;//序号 |
| | | } |
| | | Entry.Add(jsonFPOOrderEntry); |
| | | } |
| | | Entry.Add(jsonFPOOrderEntry); |
| | | jsonModel.Add("FEntity", Entry); |
| | | jsonRoot.Add("Model", jsonModel); |
| | | CloudClient cloudClient = new CloudClient("http://localhost//k3cloud/"); |
| | | var result = cloudClient.Save("Paez_Sc_WorkBillAutoSortBill", jsonRoot.ToString()); |
| | | JObject saveObj = JObject.Parse(result); |
| | | string saveIsSuc = saveObj["Result"]["ResponseStatus"]["IsSuccess"].ToString().ToUpper(); |
| | | if (saveIsSuc != "TRUE") |
| | | { |
| | | LogHelper.Error("生产计划平台保存失败:" + jsonRoot.ToString()); |
| | | this.View.ShowMessage("数据储存失败!请联系管理员!"); |
| | | } |
| | | } |
| | | jsonModel.Add("FEntity", Entry); |
| | | jsonRoot.Add("Model", jsonModel); |
| | | CloudClient cloudClient = new CloudClient("http://localhost//k3cloud/"); |
| | | var result = cloudClient.Save("Paez_Sc_WorkBillAutoSortBill", jsonRoot.ToString()); |
| | | JObject saveObj = JObject.Parse(result); |
| | | string saveIsSuc = saveObj["Result"]["ResponseStatus"]["IsSuccess"].ToString().ToUpper(); |
| | | if (saveIsSuc != "TRUE") |
| | | else |
| | | { |
| | | LogHelper.Error("生产计划平台保存失败:" + jsonRoot.ToString()); |
| | | this.View.ShowMessage("数据储存失败!请联系管理员!"); |
| | | //根据生产订单号和物料查询是否存在明细 +生产订单明细行号 |
| | | sql = string.Format(@" |
| | | /*dialect*/ |
| | | SELECT t4.FNAME as FMoFBillType,T1.FBILLNO,T2.*,t3.FNUMBER as FUnitNumber,tBom.FNUMBER as FBomNumber FROM T_PRD_MO T1 |
| | | LEFT JOIN T_PRD_MOENTRY T2 ON T1.FID = T2.FID |
| | | LEFT JOIN T_ENG_BOM tBom on t2.FBOMID = tBom.FID |
| | | join T_BD_UNIT t3 on t2.FUNITID=t3.FUNITID |
| | | join ( select A.FBILLTYPEID,B.FNAME from T_BAS_BILLTYPE A |
| | | JOIN T_BAS_BILLTYPE_L B ON A.FBILLTYPEID =B.FBILLTYPEID |
| | | where FBILLFORMID='PRD_MO' AND FNAME<>'生產訂單')t4 on t1.FBILLTYPE =t4.FBILLTYPEID |
| | | WHERE T1.FBILLNO = '{0}' AND T2.FMATERIALID = '{1}' AND T2.FSEQ = '{2}'", Convert.ToString(current["FSCOrderNo"]), Convert.ToString(current["FMatrailId_Id"]), Convert.ToString(current["FSRCBILLENTRYSEQ"])); |
| | | DataTable dt = new DataTable(); |
| | | dt = DBServiceHelper.ExecuteDataSet(Context, sql).Tables[0]; |
| | | if (dt.Rows.Count == 0) |
| | | continue; |
| | | string FID = "";//FID 源单主内码 |
| | | string FENTRYID = "";//FENTRYID 源单子内码 |
| | | string FLOT = "";//FLOT 批次 |
| | | string FQTY = "";//FQTY 生产订单数量 |
| | | string FBILLNO = "";//FBILLNO 原单号 |
| | | string FHUnitID = "";//单位 |
| | | string FPlanBeginDate = "";//开始日期 |
| | | string FPlanEndDate = "";//结束日期 |
| | | string FMoFBillType = "";// |
| | | string FBomNumber = "";//Bom 版本 |
| | | if (dt.Rows.Count > 0) |
| | | { |
| | | FID = dt.Rows[0]["FID"].ToString(); |
| | | FENTRYID = dt.Rows[0]["FENTRYID"].ToString(); |
| | | FLOT = dt.Rows[0]["FLOT"].ToString(); |
| | | FQTY = dt.Rows[0]["FQTY"].ToString(); |
| | | FBILLNO = dt.Rows[0]["FBILLNO"].ToString(); |
| | | FHUnitID = dt.Rows[0]["FUnitNumber"].ToString(); |
| | | FPlanBeginDate = dt.Rows[0]["FPlanStartDate"].ToString(); |
| | | FPlanEndDate = dt.Rows[0]["FPlanFinishDate"].ToString(); |
| | | FMoFBillType = dt.Rows[0]["FMoFBillType"].ToString(); |
| | | FBomNumber = dt.Rows[0]["FBomNumber"].ToString(); |
| | | } |
| | | |
| | | //选单数据 做新增 |
| | | JObject jsonRoot = new JObject(); |
| | | jsonRoot.Add("Creator", ""); |
| | | jsonRoot.Add("NeedUpDateFields", new JArray()); |
| | | jsonRoot.Add("NeedReturnFields", new JArray()); |
| | | jsonRoot.Add("IsDeleteEntry", "false"); |
| | | jsonRoot.Add("SubSystemId", ""); |
| | | jsonRoot.Add("IsVerifyBaseDataField", ""); |
| | | JObject jsonModel = new JObject(); |
| | | jsonModel.Add("FPreparatDate", date.ToString());//编制日期 |
| | | jsonModel.Add("FMoFBillType", FMoFBillType);// |
| | | jsonModel.Add("FSRCBILLENTRYSEQ", Convert.ToString(current["FSRCBILLENTRYSEQ"]));//生产订单明细行号 |
| | | jsonModel.Add("FSCOrderNo", Convert.ToString(current["FSCOrderNo"])); //生产订单号FSCOrderNo |
| | | jsonModel.Add("FHSeOrderBillNo", Convert.ToString(current["FSalOrderNo"]));//销售订单号 |
| | | jsonModel.Add("FHOrderLev", current["FOrderLevel"].ToString());//订单等级 |
| | | jsonModel.Add("FHOrderQty", Convert.ToString(current["FSalOrderCount"]));//销售订单数量 |
| | | jsonModel.Add("FHOrderCommitDate", Convert.ToString(current["FDeliveryDate"]));//交货期HOrderCommitDate |
| | | jsonModel.Add("FHUnitID", new JObject() { ["Fnumber"] = FHUnitID });//单位 |
| | | jsonModel.Add("FBOMID", new JObject() { ["Fnumber"] = FBomNumber });//BOM版本 |
| | | jsonModel.Add("FHPlanBeginDate", FPlanBeginDate);//计划开始日期 |
| | | jsonModel.Add("FHPlanEndDate", FPlanEndDate);//计划完工日期 |
| | | //jsonModel.Add("FBatch", current["FBatch"].ToString());//批次 |
| | | jsonModel.Add("FBatch", FLOT);//批次 |
| | | jsonModel.Add("FHOrderNeedQty", FQTY);// 订单需求数量 |
| | | jsonModel.Add("FPrdBillNo", FBILLNO); ;//源单编号 |
| | | jsonModel.Add("FPRDMOMAINID", FID); ;//源单主内码 |
| | | jsonModel.Add("FPRDMOENTYID", FENTRYID); ;//源单子内码 |
| | | jsonModel.Add("FMoFID", FID); ;//源单主内码 |
| | | jsonModel.Add("FMoFentryId", FENTRYID); ;//源单子内码 |
| | | jsonModel.Add("FOrderQuantity", Convert.ToString(current["FOrderQuantity"])); ;//生产订单数量 |
| | | jsonModel.Add("FDayPlanQuantity", Convert.ToString(current["FDayPlanQuantity"])); ;//日计划数量 |
| | | jsonModel.Add("FNoScheduled", Convert.ToString(current["FNoScheduled"])); ;//未排数量 |
| | | JObject jsonFHMaterID = new JObject(); |
| | | jsonFHMaterID.Add("FNumber", (current["FMatrailId"] as DynamicObject)["Number"].ToString()); |
| | | jsonModel.Add("FHMaterID", jsonFHMaterID);//FHMaterID 物料 |
| | | if (Convert.ToString(current["FORGID_Id"]) != "0") |
| | | { |
| | | JObject jsonFHPRDORGID = new JObject(); |
| | | jsonFHPRDORGID.Add("FNumber", (current["FORGID"] as DynamicObject)["Number"].ToString()); |
| | | jsonModel.Add("FHPRDORGID", jsonFHPRDORGID);//FHMaterID 生产组织 |
| | | |
| | | } |
| | | if (Convert.ToString(current["FResourcesId_Id"]) != "0") |
| | | { |
| | | JObject jsonFProductWorkShopId = new JObject(); |
| | | jsonFProductWorkShopId.Add("FNumber", (current["FResourcesId"] as DynamicObject)["Number"].ToString()); |
| | | jsonModel.Add("FHSourceID", jsonFProductWorkShopId);//FHSourceID 生产车间 |
| | | } |
| | | if (Convert.ToString(current["FProductWorkShopId_Id"]) != "0") |
| | | { |
| | | JObject jsonFResourcesId = new JObject(); |
| | | jsonFResourcesId.Add("FNumber", (current["FProductWorkShopId"] as DynamicObject)["Number"].ToString()); |
| | | jsonModel.Add("FHWorkShopID", jsonFResourcesId);//FHWorkShopID 生产资源 |
| | | } |
| | | JArray Entry = new JArray(); |
| | | for (int i = 0; i <= 60; i++) |
| | | { |
| | | if (Convert.ToString(current["FT" + "" + i + ""]) == "" || Convert.ToString(current["FT" + "" + i + ""]) == "0") |
| | | continue; |
| | | JObject jsonFPOOrderEntry = new JObject(); |
| | | jsonFPOOrderEntry.Add("FHMasterDate", date.AddDays(i).ToShortDateString()); ;//主日期 |
| | | jsonFPOOrderEntry.Add("FHQty ", Convert.ToString(current["FT" + "" + i + ""])); ;//日计划数量 |
| | | Entry.Add(jsonFPOOrderEntry); |
| | | } |
| | | jsonModel.Add("FEntity", Entry); |
| | | jsonRoot.Add("Model", jsonModel); |
| | | CloudClient cloudClient = new CloudClient("http://localhost//k3cloud/"); |
| | | var result = cloudClient.Save("Paez_Sc_WorkBillAutoSortBill", jsonRoot.ToString()); |
| | | JObject saveObj = JObject.Parse(result); |
| | | string saveIsSuc = saveObj["Result"]["ResponseStatus"]["IsSuccess"].ToString().ToUpper(); |
| | | if (saveIsSuc != "TRUE") |
| | | { |
| | | LogHelper.Error("生产计划平台保存失败:" + jsonRoot.ToString()); |
| | | this.View.ShowMessage("数据储存失败!请联系管理员!"); |
| | | } |
| | | if (saveIsSuc == "TRUE") |
| | | { |
| | | string FDayPlanBillNo = saveObj["Result"]["Number"].ToString(); |
| | | string FDayPlanID = saveObj["Result"]["Id"].ToString(); |
| | | this.Model.SetValue("FDayPlanBillNo", FDayPlanBillNo, Convert.ToInt32(current["SEQ"]) - 1);// |
| | | this.Model.SetValue("FDayPlanID", FDayPlanID, Convert.ToInt32(current["SEQ"]) - 1);// |
| | | } |
| | | } |
| | | } |
| | | |
| | | this.View.ShowMessage("操作成功"); |
| | | SearchList(); |
| | | } |
| | |
| | | // using Kingdee.BOS.KDThread; |
| | | MainWorker.QuequeTask(() => |
| | | { |
| | | var resuult = ""; |
| | | try |
| | | { |
| | | // 需要捕获错误,以确保处理结束时,关闭进度滚动界面 |
| | | // 引入功能实际处理函数 |
| | | this.CompleteSetAnalysisByDataTable(); |
| | | resuult = this.CompleteSetAnalysisByDataTable(); |
| | | } |
| | | finally |
| | | { |
| | |
| | | { |
| | | processView.Close(); |
| | | this.View.SendDynamicFormAction(processView); |
| | | this.View.ShowMessage(resuult); |
| | | } |
| | | } |
| | | }, |
| | |
| | | { |
| | | Stopwatch sw = new Stopwatch(); |
| | | sw.Start();//开始计时 |
| | | //清空齐套临时表 |
| | | //清空齐套临时表 |
| | | DBServiceHelper.Execute(Context, "/*dialect*/ delete JIT_MOMaterReadysBill "); |
| | | //更新状态 |
| | | DBServiceHelper.Execute(Context, "/*dialect*/ update Sc_WorkBillSortBillsub set FCOMPLETE='' "); |
| | |
| | | |
| | | } |
| | | } |
| | | public void CompleteSetAnalysisByDataTable() |
| | | public string CompleteSetAnalysisByDataTable() |
| | | { |
| | | LogHelper.Info("齐套分析sql模式开始准备数据:"); |
| | | string sql = ""; |
| | |
| | | insertDT.Columns.Add("FPRDBILLNO", typeof(string)); |
| | | insertDT.Columns.Add("FOWNERID", typeof(long)); |
| | | insertDT.Columns.Add("FOWNERTYPEID", typeof(string)); |
| | | |
| | | //insertDT.Columns.Add("FIDENTIFICAT", typeof(long)); |
| | | |
| | | insertDT.Columns.Add("FPLANDATE", typeof(DateTime)); |
| | | insertDT.Columns.Add("FCOMPLETE", typeof(string)); |
| | | insertDT.Columns.Add("FLACKCOUNT", typeof(decimal)); |
| | | insertDT.Columns.Add("FOCCUPYCOUNT", typeof(decimal)); |
| | | insertDT.Columns.Add("FCOMPLETECOUNT1", typeof(decimal)); |
| | | insertDT.Columns.Add("FERPCLSID", typeof(string)); |
| | | |
| | | int jdtmmm = 1; |
| | | foreach (var item in completeAnalysisTempModel) |
| | | { |
| | |
| | | dr["FPRDBILLNO"] = item.FPRDBillNo; |
| | | dr["FOWNERID"] = item.FOwnerId == null ? "0" : item.FOwnerId; |
| | | dr["FOWNERTYPEID"] = "BD_OwnerOrg"; |
| | | |
| | | //dr["FIDENTIFICAT"] = ""; |
| | | |
| | | dr["FPLANDATE"] = item.FPlanDate.ToString("yyyy-MM-dd"); |
| | | dr["FCOMPLETE"] = item.FComPlete; |
| | | dr["FLACKCOUNT"] = item.FLackCount; |
| | |
| | | "); |
| | | sw.Stop();//结束计时 |
| | | LogHelper.Info("齐套分析运行总时长:" + sw.Elapsed); |
| | | return "操作成功"; |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | LogHelper.Error("齐套分析跳出:" + ex.Message.ToString()); |
| | | return "操作失败," + ex.Message.ToString(); |
| | | |
| | | } |
| | | } |
| | |
| | | // using Kingdee.BOS.KDThread; |
| | | MainWorker.QuequeTask(() => |
| | | { |
| | | var result = "操作成功"; |
| | | try |
| | | { |
| | | // 需要捕获错误,以确保处理结束时,关闭进度滚动界面 |
| | | // 引入功能实际处理函数 |
| | | this.DayPlanPPBomBillBatch(); |
| | | result = this.DayPlanPPBomBillBatch(); |
| | | } |
| | | finally |
| | | { |
| | |
| | | { |
| | | processView.Close(); |
| | | this.View.SendDynamicFormAction(processView); |
| | | this.View.ShowMessage("操作成功"); |
| | | this.View.ShowMessage(result); |
| | | } |
| | | } |
| | | }, |
| | | (t) => { }); |
| | | |
| | | //this.View.ShowMessage("操作成功"); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 日计划用料清单生成 |
| | | /// </summary> |
| | | public void DayPlanPPBomBillBatch() |
| | | public string DayPlanPPBomBillBatch() |
| | | { |
| | | //LogService.WriteAsync(entrys); |
| | | //查找到的同批项次 |
| | | int day = Convert.ToInt32(this.Model.GetValue("FLockDays")); |
| | | Entity entity = this.View.BillBusinessInfo.GetEntity("FEntity"); |
| | | //单据体信息转换为列表集合 |
| | | DynamicObjectCollection entityDataObjoct = this.View.Model.GetEntityDataObject(entity); |
| | |
| | | LEFT join T_ORG_Organizations t10 on t2.FHPRDORGID = t10.FORGID |
| | | LEFT join T_ENG_WORKCENTER t11 on t2.FHSOURCEID = t11.FID |
| | | left join T_BD_DEPARTMENT td on t3.FWORKSHOPID=td.FDEPTID |
| | | WHERE t1.FEntryID not in |
| | | WHERE |
| | | t1.FHMASTERDATE between DATEADD(day,-1,getdate()) and DATEADD(day,{{1} - 1},getdate()) |
| | | and t1.FEntryID not in |
| | | ( |
| | | select distinct FDAYPLANFID from Sc_DayPlanPPBomBillMain where FID IN ( |
| | | select distinct FDAYPLANFID from T_PRD_PICKMTRLDATA) |
| | | select distinct FDAYPLANFID from Sc_DayPlanPPBomBillMain where FID IN |
| | | ( |
| | | --领料单 |
| | | select distinct FDAYPLANFID from T_PRD_PICKMTRLDATA |
| | | union all |
| | | --日计划用料清单变更单 |
| | | select distinct FDAYPLANID from Sc_DayPlanPPBomBillSubBG |
| | | ) |
| | | ) |
| | | AND {0} |
| | | -- and T4.FMustQty>0 |
| | |
| | | -- select FDayPlanFID FROM Sc_DayPlanPPBomBillMain WHERE FID IN ( select distinct FID from Sc_DayPlanPPBomBillSub WHERE FTranslateQty >0 or FPickedQty >0) |
| | | -- ) |
| | | ", |
| | | sqlWhere); |
| | | sqlWhere, day); |
| | | LogHelper.Info("生成日计划用料清单准备数据sql:" + sql); |
| | | DataSet ds = DBServiceHelper.ExecuteDataSet(Context, sql); |
| | | DataTable dt = ds.Tables[0]; |
| | |
| | | ["IsDeleteEntry"] = "true", |
| | | ["SubSystemId"] = "", |
| | | ["IsVerifyBaseDataField"] = "false", |
| | | ["IsAutoSubmitAndAudit"] = true,//自动调用提交和审核功能 |
| | | ["Model"] = Fentity |
| | | }; |
| | | CloudClient cloudClient = new CloudClient("http://localhost//k3cloud/"); |
| | |
| | | } |
| | | if (saveIsSuc != "TRUE") |
| | | { |
| | | LogHelper.Error("日计划用料清单列表生成失败:" + jsonRoot.ToString()); |
| | | //LogHelper.Error("日计划用料清单列表生成失败:" + jsonRoot.ToString()); |
| | | LogHelper.Error(saveObj.ToString()); |
| | | this.View.ShowMessage(saveObj["Result"]["ResponseStatus"]["Errors"][0]["Message"].ToString()); |
| | | return "操作失败," + saveObj["Result"]["ResponseStatus"]["Errors"][0]["Message"].ToString(); |
| | | //this.View.ShowMessage(saveObj["Result"]["ResponseStatus"]["Errors"][0]["Message"].ToString()); |
| | | } |
| | | Fentity = new JArray(); |
| | | } |
| | |
| | | } |
| | | sw.Stop();//结束计时 |
| | | LogHelper.Info("生成日计划用料清单运行总时长:" + sw.Elapsed); |
| | | return "操作成功"; |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | LogHelper.Error("日计划用料清单+" + ex.Message.ToString()); |
| | | this.View.ShowErrMessage(ex.Message.ToString()); |
| | | return "操作失败," + ex.Message.ToString(); |
| | | //this.View.ShowErrMessage(ex.Message.ToString()); |
| | | } |
| | | } |
| | | |
| | |
| | | { |
| | | var DayPlanPpbomls = DayPlanPpbom.Where(c => c.FENTRYID == id && c.FMATERIALID == _item.FMATERIALID).FirstOrDefault(); |
| | | decimal Qty = DayPlanPpbomls.NeedQty;//订单数量 |
| | | //if (Qty == 0) |
| | | // LogHelper.Info("订单数量为0"); |
| | | //if (Qty == 0) |
| | | // LogHelper.Info("订单数量为0"); |
| | | if (Qty > _NeedQty) |
| | | Qty = _NeedQty; //订单数量>采购订单数量 取采购订单 |
| | | |
| | |
| | | FentityModel.Add("FHPOOrderEntryID", _item.PurchseFentryID); //采购订单子内码:FHPOOrderEntryID |
| | | FentityModel.Add("FHPOOrderBillNo", _item.PurchseFBillNo); //采购订单号:FHPOOrderBillNo |
| | | FentityModel.Add("FERPCLSID", _item.FErpClsID); //发料方式 |
| | | //FentityModel.Add("FSEQ", FSEQ); //发料方式 |
| | | //FentityModel.Add("FSEQ", FSEQ); //发料方式 |
| | | FentityModel.Add("FUnitID", new JObject() { ["Fnumber"] = "Pcs" }); //发料方式 |
| | | |
| | | Fentity.Add(FentityModel); |
| | |
| | | lockStockArgs.FID = Convert.ToInt32(current["FHMainSourceInterID"]); //生产订单行ID |
| | | lockStockArgs.BaseQty = decimal.Parse(dr["FBASEQTY"].ToString());//基本单位数量 |
| | | lockStockArgs.BaseUnitID = int.Parse(dr["FBASEUNITID"].ToString());//基本单位 |
| | | //lockStockArgs.Lot = Convert.ToString(current["FBatch"]); ;//批次 FBatch |
| | | //lockStockArgs.Lot = Convert.ToString(current["FBatch"]); ;//批次 FBatch |
| | | lockStockArgs.MaterialID = long.Parse(dr["FMATERIALID2"].ToString()); |
| | | lockStockArgs.OwnerID = long.Parse(dr["FOwnerID"].ToString()); |
| | | lockStockArgs.OwnerTypeID = dr["FOwnerTypeID"].ToString(); |
| | |
| | | { |
| | | foreach (var listSelectedRow in listSelectedRowCollection) |
| | | { |
| | | string sql = $"select DATEDIFF(d,FPlanStartDate,getdate())days from T_PRD_MOENTRY where FENTRYID = {listSelectedRow.DataRow["t1_FENTRYID"].ToString()}"; |
| | | int day = DBServiceHelper.ExecuteScalar<int>(Context, sql, 0); |
| | | this.Model.CreateNewEntryRow("FEntity"); |
| | | this.View.Model.SetValue("FORGID", 100, Fseq); |
| | | this.View.Model.SetItemValueByNumber("FORGID", "100", Fseq); |
| | | this.View.Model.SetValue("FSCOrderNo", listSelectedRow.DataRow["FBillNo"].ToString(), Fseq); |
| | | this.View.Model.SetValue("FSRCBILLENTRYSEQ", listSelectedRow.DataRow["t1_FSeq"].ToString(), Fseq); |
| | | this.View.Model.SetValue("FMatrailId", listSelectedRow.DataRow["FMaterialId_Id"].ToString(), Fseq); |
| | | this.View.Model.SetValue("FMatrailId", listSelectedRow.DataRow["FMaterialId_Id"].ToString(), Fseq);//2129900005 |
| | | this.View.Model.SetValue("FFUnit", listSelectedRow.DataRow["FUnitId_Id"].ToString(), Fseq); |
| | | this.View.Model.SetValue("FOrderQuantity", listSelectedRow.DataRow["FQty"].ToString(), Fseq); |
| | | this.View.Model.SetValue("FProductWorkShopId", listSelectedRow.DataRow["FWorkShopID_Id"].ToString(), Fseq); |
| | | this.View.Model.SetValue("FOrderLevel", "3", Fseq); |
| | | this.View.Model.SetValue("FT" + day.ToString(), listSelectedRow.DataRow["FQty"].ToString(), Fseq); |
| | | Fseq++; |
| | | } |
| | | } |