| | |
| | | } |
| | | } |
| | | ds = oCN.RunProcReturn($"select HInterID,HICMOBillNo from Sc_WorkBillSortBillMain with(nolock) where HMainSourceInterID={HMainSourceInterID}" + |
| | | $" and HMainSourceEntryID={HMainSourceEntryID} and HICMOBillNo='{HICMOBillNo}' and HICMOEntrySEQ={HICMOEntrySEQ} and HSourceID={HSourceID}", "Sc_WorkBillSortBillMain"); |
| | | $" and HMainSourceEntryID={HMainSourceEntryID} and HICMOBillNo='{HICMOBillNo}' and HICMOEntrySEQ={HICMOEntrySEQ} and HSourceID={HSourceID} and ISNULL(HDeleteMan,'')=''", "Sc_WorkBillSortBillMain"); |
| | | |
| | | if (ds.Tables[0].Rows.Count > 0) |
| | | { |
| | |
| | | else |
| | | { |
| | | ds = oCN.RunProcReturn($"select HInterID,HICMOBillNo from Sc_WorkBillSortBillMain with(nolock) where HMainSourceInterID={HMainSourceInterID}" + |
| | | $" and HMainSourceEntryID={HMainSourceEntryID} and HICMOBillNo='{HICMOBillNo}' and HICMOEntrySEQ={HICMOEntrySEQ} and HSourceID={HSourceID}", "Sc_WorkBillSortBillMain"); |
| | | $" and HMainSourceEntryID={HMainSourceEntryID} and HICMOBillNo='{HICMOBillNo}' and HICMOEntrySEQ={HICMOEntrySEQ} and HSourceID={HSourceID} and ISNULL(HDeleteMan,'') = ''", "Sc_WorkBillSortBillMain"); |
| | | |
| | | 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")); |
| | | $" and HMainSourceEntryID={HMainSourceEntryID} and HICMOBillNo='{HICMOBillNo}' and HICMOEntrySEQ={HICMOEntrySEQ} and HSourceID={HSourceID} and ISNULL(HDeleteMan,'')=''", DateTime.Now.ToString("yyyy-MM-dd")); |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = $"第{i + 1}è¡çäº§èµæºæéå¤,请修æ¹!"; |
| | |
| | | } |
| | | |
| | | public json AddBillSub(string HInterID, string HBillNo, DateTime date, double HQTY, Dictionary<string, string> dic) |
| | | { |
| | | { |
| | | string sReturn = ""; |
| | | oSystemParameter.ShowBill(ref sReturn); |
| | | |
| | | //è·åè¡¨æ ¼æ°æ® |
| | | ds = oCN.RunProcReturn($"select * from h_v_JIT_Sc_WorkBillSortBill_PC where åæ®å·='{HBillNo}'", "h_v_JIT_Sc_WorkBillSortBill_PC"); |
| | | int count = 0; |
| | | if (ds.Tables[0].Rows.Count > 0) |
| | | { |
| | | //夿å表æ¯å¦æå½æ¥çæ¥æä»¥åæ¥ææå¯¹åºçæ°é |
| | | for (int i = 0; i < ds.Tables[0].Rows.Count; i++) |
| | | if (oSystemParameter.omodel.WMS_CampanyName == "æ·»åº·ç§æ") //ç³»ç»åæ° å®¢æ·å®å¶ååç§° 空ç½ä¸ºéç¨ |
| | | { |
| | | if (DateTime.Parse(ds.Tables[0].Rows[i]["æ¥è®¡åçäº§æ¥æ"].ToString()) == date) |
| | | //夿å表æ¯å¦æå½æ¥çæ¥æä»¥åæ¥ææå¯¹åºçæ°é |
| | | for (int i = 0; i < ds.Tables[0].Rows.Count; i++) |
| | | { |
| | | oCN.RunProc($"update Sc_WorkBillSortBillSub set HMasterDate='{date}',HQty={HQTY},HUseTimes={(dic["å°æ¶äº§è½"]=="0"?0: HQTY / float.Parse(dic["å°æ¶äº§è½"].ToString()))}" + |
| | | $" where HInterID={HInterID} and HEntryID={ds.Tables[0].Rows[i]["hsubid"].ToString()}"); |
| | | count += 1; |
| | | if (DateTime.Parse(ds.Tables[0].Rows[i]["æ¥è®¡åçäº§æ¥æ"].ToString()) == date) |
| | | { |
| | | oCN.RunProc($"update Sc_WorkBillSortBillSub set HMasterDate='{date}',HQty={HQTY},HUseTimes={(dic["产线æ»äº§è½"] == "0" ? 0 : HQTY / float.Parse(dic["产线æ»äº§è½"].ToString()))}" + |
| | | $" where HInterID={HInterID} and HEntryID={ds.Tables[0].Rows[i]["hsubid"].ToString()}"); |
| | | count += 1; |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | //夿å表æ¯å¦æå½æ¥çæ¥æä»¥åæ¥ææå¯¹åºçæ°é |
| | | for (int i = 0; i < ds.Tables[0].Rows.Count; i++) |
| | | { |
| | | if (DateTime.Parse(ds.Tables[0].Rows[i]["æ¥è®¡åçäº§æ¥æ"].ToString()) == date) |
| | | { |
| | | oCN.RunProc($"update Sc_WorkBillSortBillSub set HMasterDate='{date}',HQty={HQTY},HUseTimes={(dic["å°æ¶äº§è½"] == "0" ? 0 : HQTY / float.Parse(dic["å°æ¶äº§è½"].ToString()))}" + |
| | | $" where HInterID={HInterID} and HEntryID={ds.Tables[0].Rows[i]["hsubid"].ToString()}"); |
| | | count += 1; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | 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.0000" ? 0 : dic["å°æ¶äº§è½"] == "0" ? 0 : HQTY / float.Parse(dic["å°æ¶äº§è½"].ToString())).ToString() == "éæ°å" ? 0 : dic["å°æ¶äº§è½"] == "0.0000" ? 0 : dic["å°æ¶äº§è½"] == "0" ? 0 : HQTY / float.Parse(dic["å°æ¶äº§è½"].ToString())) })"); |
| | | if (oSystemParameter.omodel.WMS_CampanyName == "æ·»åº·ç§æ") //ç³»ç»åæ° å®¢æ·å®å¶ååç§° 空ç½ä¸ºéç¨ |
| | | { |
| | | //æå
¥å表 |
| | | oCN.RunProc("insert into Sc_WorkBillSortBillSub(HInterID,HSEQ," + |
| | | "HMasterDate,HQty,HUseTimes)" + |
| | | $"values({HInterID}, {(ds.Tables[0].Rows.Count + 1)}," + |
| | | $" '{date}', {HQTY},{ ((dic["产线æ»äº§è½"] == "0.0000" ? 0 : dic["产线æ»äº§è½"] == "0" ? 0 : HQTY / float.Parse(dic["产线æ»äº§è½"].ToString())).ToString() == "éæ°å" ? 0 : dic["产线æ»äº§è½"] == "0.0000" ? 0 : dic["产线æ»äº§è½"] == "0" ? 0 : HQTY / float.Parse(dic["产线æ»äº§è½"].ToString())) })"); |
| | | } |
| | | else |
| | | { |
| | | //æå
¥å表 |
| | | oCN.RunProc("insert into Sc_WorkBillSortBillSub(HInterID,HSEQ," + |
| | | "HMasterDate,HQty,HUseTimes)" + |
| | | $"values({HInterID}, {(ds.Tables[0].Rows.Count + 1)}," + |
| | | $" '{date}', {HQTY},{ ((dic["å°æ¶äº§è½"] == "0.0000" ? 0 : dic["å°æ¶äº§è½"] == "0" ? 0 : HQTY / float.Parse(dic["å°æ¶äº§è½"].ToString())).ToString() == "éæ°å" ? 0 : dic["å°æ¶äº§è½"] == "0.0000" ? 0 : dic["å°æ¶äº§è½"] == "0" ? 0 : HQTY / float.Parse(dic["å°æ¶äº§è½"].ToString())) })"); |
| | | } |
| | | } |
| | | |
| | | string sReturn = ""; |
| | | oSystemParameter.ShowBill(ref sReturn); |
| | | |
| | | if (oSystemParameter.omodel.WMS_CampanyName == "æ·»åº·ç§æ") //ç³»ç»åæ° å®¢æ·å®å¶ååç§° 空ç½ä¸ºéç¨ |
| | | { |
| | | //ææäº§è®¢åå®å·¥æ¥æååå°éè¶éå®è®¢åä¸ |
| | |
| | | } |
| | | #endregion |
| | | |
| | | [Route("JIT_DayPlanPlatFormBill/JIT_CompleteSetAnalysis")] |
| | | [HttpGet] |
| | | public object JIT_CompleteSetAnalysis(string sWhere, string user) |
| | | #region é½å¥åæ åè°ç¨æ¹æ³ |
| | | |
| | | public object JIT_CompleteSetAnalysis_Old(string sWhere, string user) |
| | | { |
| | | try |
| | | { |
| | |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region é½å¥åæè°ç¨æ¹æ³ 20250402 |
| | | |
| | | [Route("JIT_DayPlanPlatFormBill/JIT_CompleteSetAnalysis")] |
| | | [HttpGet] |
| | | public object JIT_CompleteSetAnalysis(string sWhere, string user) |
| | | { |
| | | try |
| | | { |
| | | string sErrMsg = ""; |
| | | if (oSystemParameter.ShowBill(ref sErrMsg) == true) |
| | | { |
| | | if (oSystemParameter.omodel.WMS_CampanyName == "å¸
å¨" |
| | | || oSystemParameter.omodel.WMS_CampanyName == "å¯è´å¥ç¹" |
| | | || oSystemParameter.omodel.WMS_CampanyName == "æ·»åº·ç§æ" |
| | | || oSystemParameter.omodel.WMS_CampanyName == "å®å·¥") //ç³»ç»åæ° å®¢æ·å®å¶ååç§° 空ç½ä¸ºéç¨ |
| | | { |
| | | objJsonResult = (json)JIT_CompleteSetAnalysis_Old(sWhere, user); |
| | | } |
| | | else |
| | | { |
| | | objJsonResult = (json)JIT_CompleteSetAnalysis_New(sWhere, user); |
| | | } |
| | | return objJsonResult; |
| | | } |
| | | else |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "è·åç³»ç»åæ°å¤±è´¥ï¼ " + sErrMsg; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | LogService.Write("é½å¥åææä½å¤±è´¥ï¼" + e.Message.ToString()); |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "Exceptionï¼" + e.Message.ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// é½å¥åæ æ°è°ç¨æ¹æ³ |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public object JIT_CompleteSetAnalysis_New(string sWhere, string user) |
| | | { |
| | | try |
| | | { |
| | | omdelMian = JsonConvert.DeserializeObject<Sc_WorkBillSortBillMain>(sWhere); |
| | | string HWorkShopID = omdelMian.HWorkShopID.ToString(); |
| | | var HStockOrgID = omdelMian.HProdORGID; |
| | | |
| | | ds = oCN.RunProcReturn("exec h_p_JIT_CompleteSetAnalysis " + HWorkShopID.ToString() + ",'" + user + "'," + HStockOrgID.ToString(), "h_p_JIT_CompleteSetAnalysis"); |
| | | if (ds == null || ds.Tables[0].Rows.Count == 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "é½å¥åæåçé误ï¼"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | else if (DBUtility.ClsPub.isLong(ds.Tables[0].Rows[0]["HBack"]) == 1) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HRemark"]); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | else |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HRemark"]); //è¿ç®æå |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "é½å¥åæå¤±è´¥ï¼" + e.ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #endregion |
| | | |
| | | #region ç产æ¥è®¡åå¹³å° ææè¿ç® |
| | |
| | | string fProWorkShopId = omdelMian.HWorkShopID.ToString(); |
| | | var fPrdOrgId = omdelMian.HProdORGID; |
| | | string sqlName = "";//AIS20210811135644 |
| | | string WMS_CampanyName = ""; //客æ·åç§° |
| | | //客æ·å¶å® |
| | | string sErr = ""; |
| | | if (oSystemParameter.ShowBill(ref sErr)) |
| | |
| | | if (oSystemParameter.omodel.WMS_CampanyName == "å¸
å¨") |
| | | { |
| | | sqlName = "AIS20230129011339"; |
| | | WMS_CampanyName = "å¸
å¨"; |
| | | } |
| | | else if (oSystemParameter.omodel.WMS_CampanyName == "å¯è´å¥ç¹") |
| | | { |
| | | sqlName = "AIS20210820164804"; |
| | | WMS_CampanyName = "å¯è´å¥ç¹"; |
| | | } |
| | | else if (oSystemParameter.omodel.WMS_CampanyName == "æ·»åº·ç§æ") |
| | | { |
| | | sqlName = "AIS20240809105013"; |
| | | WMS_CampanyName = "æ·»åº·ç§æ"; |
| | | } |
| | | else if (oSystemParameter.omodel.WMS_CampanyName == "å®å·¥") |
| | | { |
| | | sqlName = "AIS20250102123554"; |
| | | WMS_CampanyName = "å®å·¥"; |
| | | } |
| | | else |
| | | { |
| | | sqlName = "AIS20210811135644"; |
| | | } |
| | | |
| | | if (WMS_CampanyName == "å®å·¥") |
| | | { |
| | | objJsonResult = (json)JIT_MOMaterLack(fProWorkShopId, fPrdOrgId, user); |
| | | } |
| | | else if (HTLType == "缺æ") |
| | | { |
| | | if (WMS_CampanyName == "å¸
å¨" || WMS_CampanyName == "å¯è´å¥ç¹" || WMS_CampanyName == "æ·»åº·ç§æ") |
| | | { |
| | | objJsonResult = (json)JIT_QL(fProWorkShopId, fPrdOrgId, user, sqlName); |
| | | } |
| | | else |
| | | { |
| | | objJsonResult = (json)JIT_MOMaterReady(fProWorkShopId, fPrdOrgId, user); |
| | | } |
| | | } |
| | | else if (HTLType == "çäº§ç¨ææ¸
å") |
| | | { |
| | | objJsonResult = (json)JIT_PPBOM(fProWorkShopId, fPrdOrgId, user, sqlName); |
| | | } |
| | | |
| | | return objJsonResult; |
| | | } |
| | | |
| | | |
| | | if (HTLType == "缺æ") |
| | | else |
| | | { |
| | | objJsonResult = (json)JIT_QL(fProWorkShopId, fPrdOrgId, user, sqlName); |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "è·åç³»ç»åæ°å¤±è´¥ï¼ " + sErr; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | else if (HTLType == "çäº§ç¨ææ¸
å") |
| | | { |
| | | objJsonResult=(json)JIT_PPBOM(fProWorkShopId, fPrdOrgId, user, sqlName); |
| | | } |
| | | |
| | | return objJsonResult; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// éè¿æ¬ æè¡¨ ç®ææ å®å·¥ |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public object JIT_MOMaterLack(string HWorkShopID, int? HProdORGID, string user) |
| | | { |
| | | try |
| | | { |
| | | ds = oCN.RunProcReturn("exec h_p_JIT_PODemandPlanBill_MOMaterLack " + HWorkShopID.ToString() + ",'" + user + "'," + HProdORGID.ToString(), "h_p_JIT_PODemandPlanBill_MOMaterLack"); |
| | | if (ds == null || ds.Tables[0].Rows.Count == 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "ææè¿ç®åçé误ï¼"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | else if (DBUtility.ClsPub.isLong(ds.Tables[0].Rows[0]["HBack"]) == 1) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HRemark"]); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | else |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HRemark"]); //è¿ç®æå |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "ææè¿ç®å¤±è´¥ï¼" + e.ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// éè¿é½å¥è¡¨ ç®ææ |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public object JIT_MOMaterReady(string HWorkShopID, int? HProdORGID, string user) |
| | | { |
| | | try |
| | | { |
| | | ds = oCN.RunProcReturn("exec h_p_JIT_PODemandPlanBill_MOMaterReady " + HWorkShopID.ToString() + ",'" + user + "'," + HProdORGID.ToString(), "h_p_JIT_PODemandPlanBill_MOMaterReady"); |
| | | if (ds == null || ds.Tables[0].Rows.Count == 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "ææè¿ç®åçé误ï¼"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | else if (DBUtility.ClsPub.isLong(ds.Tables[0].Rows[0]["HBack"]) == 1) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HRemark"]); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | else |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HRemark"]); //è¿ç®æå |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "ææè¿ç®å¤±è´¥ï¼" + e.ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region ç产æ¥è®¡åå¹³å° éå® |
| | |
| | | } |
| | | #endregion |
| | | |
| | | |
| | | |
| | | } |
| | | } |