| | |
| | | |
| | | LogService.CustomWriteLog("2:", DateTime.Now.ToString("yyyy-MM-dd")); |
| | | int TrueCount = 0, SumCount = 0; |
| | | |
| | | LogService.CustomWriteLog("list.Count:"+ list.Count, DateTime.Now.ToString("yyyy-MM-dd")); |
| | | for (int i = 0; i < list.Count; i++) |
| | | { |
| | | TrueCount = 0; |
| | |
| | | var HBillNo = ""; |
| | | if (list[i]["åæ®å·"].ToString() == "" && list[i]["hmainid"].ToString() == "") |
| | | { |
| | | LogService.CustomWriteLog("2.01:" + i, DateTime.Now.ToString("yyyy-MM-dd")); |
| | | var HICMOBillNo = list[i]["ç产订åå·"].ToString(); |
| | | var HOrderType = list[i]["订åç±»å"].ToString(); |
| | | var HICMOEntrySEQ = list[i]["ç产订åæç»è¡å·"].ToString(); |
| | |
| | | var HProdORGID = list[i]["HProdORGID"].ToString(); |
| | | var HMaterID = list[i]["HMaterID"].ToString(); |
| | | var HMaterName = list[i]["ç©æåç§°"].ToString(); |
| | | var HMaterModel = list[i]["è§æ ¼åå·"].ToString(); |
| | | var HMaterModel = list[i]["è§æ ¼åå·"].ToString().Replace("'", "''"); |
| | | var HUnitID = list[i]["HUnitID"].ToString(); |
| | | var HSeOrderBillQty = list[i]["éå®è®¢åæ°é"].ToString(); |
| | | //var HOrderNeedQty = list[i]["订åéæ±æ°é"].ToString(); |
| | |
| | | var HMainSourceEntryID = list[i]["æºååå
ç "].ToString(); |
| | | var HPlanQty = list[i]["è®¡åæ°é"].ToString(); |
| | | |
| | | LogService.CustomWriteLog("2.05:" + i, DateTime.Now.ToString("yyyy-MM-dd")); |
| | | |
| | | if (HSourceID == ""|| HSourceID == "0") |
| | | { |
| | | objJsonResult.code = "0"; |
| | |
| | | return objJsonResult; |
| | | } |
| | | |
| | | ds = oCN.RunProcReturn($"select * from Sc_WorkBillSortBillMain where HMainSourceInterID={HMainSourceInterID}" + |
| | | ds = oCN.RunProcReturn($"select * from Sc_WorkBillSortBillMain where HMainSourceInterID={HMainSourceInterID}" + |
| | | $" and HMainSourceEntryID={HMainSourceEntryID} and HICMOBillNo='{HICMOBillNo}' and HICMOEntrySEQ={HICMOEntrySEQ} and HSourceID={HSourceID}", "Sc_WorkBillSortBillMain"); |
| | | if (ds.Tables[0].Rows.Count > 0) |
| | | { |
| | |
| | | } |
| | | else |
| | | { |
| | | LogService.CustomWriteLog("2.0:" + i, DateTime.Now.ToString("yyyy-MM-dd")); |
| | | HBillNo = list[i]["åæ®å·"].ToString(); |
| | | HInterID = int.Parse(list[i]["hmainid"].ToString()); |
| | | var HMainSourceInterID = list[i]["æºå主å
ç "].ToString(); |
| | |
| | | var HOrderCommitDate = list[i]["订å交货æ"].ToString(); |
| | | var HPlanEndDate = list[i]["计åç»ææ¥æ"].ToString(); |
| | | var HSplitQty = list[i]["æåæ°é"].ToString(); |
| | | |
| | | LogService.CustomWriteLog("2.1:"+i, DateTime.Now.ToString("yyyy-MM-dd")); |
| | | |
| | | if (HSourceID == "" || HSourceID == "0") |
| | | { |
| | |
| | | |
| | | if (ds.Tables[0].Rows.Count > 1) |
| | | { |
| | | LogService.CustomWriteLog("第" + i + 1 + "è¡çäº§èµæºæéå¤,请修æ¹", DateTime.Now.ToString("yyyy-MM-dd")); |
| | | LogService.CustomWriteLog($"select * from Sc_WorkBillSortBillMain where HMainSourceInterID={HMainSourceInterID}" + |
| | | $" and HMainSourceEntryID={HMainSourceEntryID} and HICMOBillNo='{HICMOBillNo}' and HICMOEntrySEQ={HICMOEntrySEQ} and HSourceID={HSourceID}", DateTime.Now.ToString("yyyy-MM-dd")); |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = $"第{i + 1}è¡çäº§èµæºæéå¤,请修æ¹!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | LogService.CustomWriteLog("2.2:" + i, DateTime.Now.ToString("yyyy-MM-dd")); |
| | | |
| | | oCN.RunProc($"update Sc_WorkBillSortBillMain set HSourceID={(HSourceID == "" ? 0.ToString() : HSourceID)},HYX={HYX}" + |
| | | $",HWorkQty={HWorkQty},HProdTimes={HProdTimes},HReadyTimes={HReadyTimes},HLastBeginDate='{HLastBeginDate}'" + |
| | |
| | | |
| | | int SumDay = 31; //卿䏤æä¹å·® DateTime.Now.AddMonths(1).AddDays(-1).Subtract(DateTime.Now).Days; |
| | | |
| | | LogService.CustomWriteLog("2.3:" + i, DateTime.Now.ToString("yyyy-MM-dd")); |
| | | for (int j = 0; j < SumDay; j++) |
| | | { |
| | | //主表åè¡¨é½ææ°æ® |
| | |
| | | objJsonResult = AddBillSub(HInterID == 0 ? list[i]["hmainid"].ToString() : HInterID.ToString() |
| | | , HBillNo == "" ? list[i]["åæ®å·"].ToString() : HBillNo |
| | | , DateTime.Parse(DateTime.Now.AddDays(j).ToString("yyyy-MM-dd").ToString()) |
| | | , int.Parse(list[i][DateTime.Now.AddDays(j).ToString("yyyy-MM-dd")].ToString()) |
| | | , Math.Round(double.Parse(list[i][DateTime.Now.AddDays(j).ToString("yyyy-MM-dd")].ToString()),1) |
| | | , list[i]); |
| | | if (objJsonResult.count == 1) |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | LogService.CustomWriteLog("2.4:" + i, DateTime.Now.ToString("yyyy-MM-dd")); |
| | | |
| | | if (TrueCount != SumCount) |
| | | { |
| | | objJsonResult.code = "0"; |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | LogService.CustomWriteLog("2.5:", DateTime.Now.ToString("yyyy-MM-dd")); |
| | | |
| | | //忥æ¥è®¡åå·¥å |
| | | oCN.RunProc("exec REALESE_SC_ICMOBILLSTATUS_TMP"); |
| | | |
| | | LogService.CustomWriteLog("2.6:", DateTime.Now.ToString("yyyy-MM-dd")); |
| | | |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | |
| | | } |
| | | } |
| | | |
| | | public json AddBillSub(string HInterID, string HBillNo, DateTime date, int HQTY, Dictionary<string, string> dic) |
| | | { |
| | | public json AddBillSub(string HInterID, string HBillNo, DateTime date, double HQTY, Dictionary<string, string> dic) |
| | | { |
| | | //è·åè¡¨æ ¼æ°æ® |
| | | ds = oCN.RunProcReturn($"select * from h_v_JIT_Sc_WorkBillSortBillList where åæ®å·='{HBillNo}'", "h_v_JIT_Sc_WorkBillSortBillList"); |
| | | int count = 0; |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | if (count != 1) |
| | | { |
| | | //æå
¥å表 |
| | | oCN.RunProc("insert into Sc_WorkBillSortBillSub(HInterID,HSEQ," + |
| | | "HMasterDate,HQty,HUseTimes)" + |
| | | $"values({HInterID}, {(ds.Tables[0].Rows.Count + 1)}," + |
| | | $" '{date}', {HQTY},{(dic["å°æ¶äº§è½"] == "0" ? 0 : HQTY / float.Parse(dic["å°æ¶äº§è½"].ToString()))})"); |
| | | $" '{date}', {HQTY},{(dic["å°æ¶äº§è½"] == "0" ? 0 : HQTY / float.Parse(dic["å°æ¶äº§è½"].ToString()))})"); |
| | | } |
| | | |
| | | objJsonResult.code = "1"; |
| | |
| | | } |
| | | #endregion |
| | | |
| | | #region æ ¹æ®ç©æIDè·åå·¥èºè·¯çº¿ å表 |
| | | [Route("JIT_DayPlanPlatFormBill/GetRoutingListByMater")] |
| | | [HttpGet] |
| | | public object GetRoutingListByMater(int HMaterID, string user) |
| | | { |
| | | try |
| | | { |
| | | List<object> columnNameList = new List<object>(); |
| | | |
| | | int IsHavingPermissions = 1; |
| | | |
| | | //夿æ¯å¦æå·¥èºè·¯çº¿ç¼è¾æé |
| | | if (!DBUtility.ClsPub.Security_Log("Gy_RoutingBill_Edit", 1, false, user)) |
| | | { |
| | | IsHavingPermissions = 0; |
| | | } |
| | | |
| | | ds = oCN.RunProcReturn("select * from h_v_JIT_GetRoutingList_Mater where HMaterID = " + HMaterID , "h_v_JIT_GetRoutingList_Mater"); |
| | | |
| | | if (ds == null || ds.Tables[0].Rows.Count == 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "å½åç©ææ²¡æç»´æ¤å·¥èºè·¯çº¿ï¼è¯·è系计åé¨è¿è¡ç»´æ¤"; |
| | | objJsonResult.data = ds.Tables[0]; |
| | | objJsonResult.IsHavingPermissions = IsHavingPermissions; |
| | | return objJsonResult; |
| | | } |
| | | else |
| | | { |
| | | //æ·»å åå |
| | | foreach (DataColumn col in ds.Tables[0].Columns) |
| | | { |
| | | Type dataType = col.DataType; |
| | | string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}"; |
| | | columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//è·åå°DataColumnå对象çåå |
| | | } |
| | | |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "Sucessï¼"; |
| | | objJsonResult.data = ds.Tables[0]; |
| | | objJsonResult.list = columnNameList; |
| | | objJsonResult.IsHavingPermissions = IsHavingPermissions; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "Exceptionï¼" + e.ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | #endregion |
| | | } |
| | | } |