| | |
| | | jObject.Put("desc", "请点击打开附件:"); |
| | | jObject.Put("urltitle", "这是文件名"); |
| | | this.View.AddAction(JSAction.openUrlWindow, new JSONArray { jObject }); |
| | | } |
| | | } |
| | | /// <summary> |
| | | /// 锁定 |
| | | /// </summary> |
| | |
| | | Entity entity = this.View.BillBusinessInfo.GetEntity("FEntity"); |
| | | //单据体信息转换为列表集合 |
| | | DynamicObjectCollection entityDataObjoct = this.View.Model.GetEntityDataObject(entity); |
| | | DateTime date = DateTime.Now; |
| | | DateTime date = Convert.ToDateTime(DateTime.Now.ToString("d")); |
| | | |
| | | string _result = ""; |
| | | |
| | |
| | | |
| | | foreach (DynamicObject current in entityDataObjoct) |
| | | { |
| | | sql = $"/*dialect*/ update Sc_WorkBillSortBillMain set FOrderQuantity={current["FOrderQuantity"]},FDayPlanQuantity={current["FDayPlanQuantity"]},FNoScheduled={current["FNoScheduled"]} where FID = {current["FDayPlanWorkID"]}"; |
| | | sqlList.Add(sql); |
| | | DateTime FBzDate = Convert.ToDateTime(Convert.ToDateTime(current["FBzDate"])); |
| | | DateTime end = Convert.ToDateTime(Convert.ToDateTime(current["FBzDate"]).AddDays(60).ToShortDateString());//最大日期 |
| | | 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.ToString(current["FDayPlanQuantity"])); |
| | | 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++) |
| | | { |
| | | DateTime start = Convert.ToDateTime(date.AddDays(i).ToShortDateString()); |
| | | TimeSpan getDay = end.Subtract(start); |
| | | //编制日期+61天>date.AddDays(i).ToShortDateString() continue |
| | | if (getDay.Days < 0) |
| | | break; |
| | | sql = $"/*dialect*/update t1 set FHQTY='{Convert.ToString(current["FT" + "" + i + ""])}' from Sc_WorkBillSortBillSub t1 join " + |
| | | $" Sc_WorkBillSortBillMain t2 on t1.FID = t2.FID where FHMASTERDATE='{date.AddDays(i).ToShortDateString()}' and t2.FID='{Convert.ToString(current["FDayPlanWorkID"])}'"; |
| | | sqlList.Add(sql); |
| | | 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); |
| | | } |
| | | 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("数据储存失败!请联系管理员!"); |
| | | } |
| | | |
| | | |
| | | //sql = $"/*dialect*/ update Sc_WorkBillSortBillMain set FOrderQuantity={current["FOrderQuantity"]},FDayPlanQuantity={current["FDayPlanQuantity"]},FNoScheduled={current["FNoScheduled"]} where FID = {current["FDayPlanWorkID"]}"; |
| | | //sqlList.Add(sql); |
| | | //DateTime FBzDate = Convert.ToDateTime(Convert.ToDateTime(current["FBzDate"])); |
| | | //DateTime end = Convert.ToDateTime(Convert.ToDateTime(current["FBzDate"]).AddDays(60).ToShortDateString());//最大日期 |
| | | //for (int i = 0; i <= 60; i++) |
| | | //{ |
| | | // DateTime start = Convert.ToDateTime(date.AddDays(i).ToShortDateString()); |
| | | // TimeSpan getDay = end.Subtract(start); |
| | | // //编制日期+61天>date.AddDays(i).ToShortDateString() continue |
| | | // if (getDay.Days < 0) |
| | | // break; |
| | | // sql = $"/*dialect*/update t1 set FHQTY='{Convert.ToString(current["FT" + "" + i + ""])}' from Sc_WorkBillSortBillSub t1 join " + |
| | | // $" Sc_WorkBillSortBillMain t2 on t1.FID = t2.FID where FHMASTERDATE='{date.AddDays(i).ToShortDateString()}' and t2.FID='{Convert.ToString(current["FDayPlanWorkID"])}'"; |
| | | // sqlList.Add(sql); |
| | | //} |
| | | |
| | | } |
| | | |
| | | int result = DBServiceHelper.ExecuteBatch(Context, sqlList); |
| | | |
| | | this.View.ShowMessage("操作成功"); |
| | | SearchList(); |
| | | //if (result > 0) |
| | | //{ |
| | | //} |
| | | //else |
| | | // this.View.ShowMessage("操作失败,联系管理员!"); |
| | | |
| | | } |
| | | /// <summary> |
| | | /// 齐套分析 |