| | |
| | | using Newtonsoft.Json.Linq; |
| | | using System.Diagnostics; |
| | | using System.Threading; |
| | | |
| | | using System.Globalization; |
| | | namespace WebAPI.Controllers.SCGL.æ¥è®¡å管ç |
| | | { |
| | | public class JIT_DayPlanPlatFormBillController : ApiController |
| | |
| | | |
| | | try |
| | | { |
| | | Stopwatch sw = new Stopwatch();//计æ¶å¨ |
| | | sw.Start();//å¼å§è®¡æ¶ |
| | | |
| | | if (!DBUtility.ClsPub.Security_Log("Sc_WorkBillSortBill_Edit", 1, false, user)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | |
| | | |
| | | string sReturn = ""; |
| | | oSystemParameter.ShowBill(ref sReturn); |
| | | |
| | | for (int i = 0; i < list.Count; i++) |
| | | { |
| | | { |
| | | TrueCount = 0; |
| | | SumCount = 0; |
| | | long HInterID = 0; |
| | |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | |
| | | ds = oCN.RunProcReturn($"select * from Sc_WorkBillSortBillMain where HMainSourceInterID={HMainSourceInterID}" + |
| | | } |
| | | 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"); |
| | | |
| | | if (ds.Tables[0].Rows.Count > 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | |
| | | return objJsonResult; |
| | | } |
| | | |
| | | ds = oCN.RunProcReturn($"select * from Sc_WorkBillSortBillMain where HMainSourceInterID={HMainSourceInterID}" + |
| | | 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"); |
| | | |
| | | if (ds.Tables[0].Rows.Count > 1) |
| | |
| | | |
| | | oCN.RunProc($"update Sc_WorkBillSortBillMain set HDayPlanSumQty={list[i]["æ¥è®¡åæ°éæ»é"].ToString()} where HInterID={(HInterID==0?int.Parse(list[i]["hmainid"].ToString()):HInterID)} and HBillNo='{(HBillNo==""?list[i]["åæ®å·"].ToString(): HBillNo)}'"); |
| | | |
| | | int SumDay = 31; //卿䏤æä¹å·® DateTime.Now.AddMonths(1).AddDays(-1).Subtract(DateTime.Now).Days; |
| | | int SumDay = 0; //卿䏤æä¹å·® DateTime.Now.AddMonths(1).AddDays(-1).Subtract(DateTime.Now).Days; |
| | | |
| | | // ç»è®¡æ»å¤©æ° |
| | | HashSet<DateTime> uniqueDates = new HashSet<DateTime>(); |
| | | |
| | | foreach (var key in list[i].Keys) |
| | | { |
| | | if (DateTime.TryParseExact(key, "yyyy-M-d", CultureInfo.InvariantCulture, DateTimeStyles.None, out DateTime date)) |
| | | { |
| | | uniqueDates.Add(date); |
| | | } |
| | | } |
| | | |
| | | SumDay = uniqueDates.Count; |
| | | |
| | | if (oSystemParameter.omodel.WMS_CampanyName == "æ·»åº·ç§æ") //ç³»ç»åæ° å®¢æ·å®å¶ååç§° 空ç½ä¸ºéç¨ |
| | | { |
| | | SumDay = 180; |
| | | } |
| | | |
| | | LogService.CustomWriteLog("2.3:" + i, DateTime.Now.ToString("yyyy-MM-dd")); |
| | | for (int j = 0; j < SumDay; j++) |
| | |
| | | } |
| | | } |
| | | //ä¸»è¡¨ææ°æ® åè¡¨æ æ°æ® |
| | | if (j == 30 && SumCount == 0 && HInterID != 0 && HBillNo != "") |
| | | if (j == SumDay-1 && SumCount == 0 && HInterID != 0 && HBillNo != "") |
| | | { |
| | | //LogService.CustomWriteLog("3:"+ HInterID+","+ HBillNo, DateTime.Now.ToString("yyyy-MM-dd")); |
| | | objJsonResult = AddBillSub(HInterID.ToString(), HBillNo, DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd").ToString()), 0, list[i]); |
| | |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | 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")); |
| | | sw.Stop();//ç»æè®¡æ¶ |
| | | LogService.Write($"========================1.æäº§è®¢åæ»ç¨æ¶ï¼" + sw.Elapsed); |
| | | |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | |
| | | 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"); |
| | | 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) |
| | | { |
| | |
| | | "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 == "æ·»åº·ç§æ") //ç³»ç»åæ° å®¢æ·å®å¶ååç§° 空ç½ä¸ºéç¨ |
| | | { |
| | | //ææäº§è®¢åå®å·¥æ¥æååå°éè¶éå®è®¢åä¸ |
| | | string sql = "exec h_p_JIT_UpdateEndDateToERP " + HInterID + ",'" + HBillNo + "'"; |
| | | oCN.RunProc(sql); |
| | | } |
| | | |
| | | objJsonResult.code = "1"; |
| | |
| | | { |
| | | sqlName = "AIS20240809105013"; |
| | | } |
| | | else if (oSystemParameter.omodel.WMS_CampanyName == "å®å·¥") |
| | | { |
| | | sqlName = "AIS20250102123554"; |
| | | } |
| | | else |
| | | { |
| | | sqlName = "AIS20210811135644"; |
| | | } |
| | | } |
| | | |
| | | |
| | | if (HTLType == "缺æ") |
| | | { |
| | |
| | | } |
| | | #endregion |
| | | |
| | | #region ç产æ¥è®¡åå¹³å° éå®å·¥å |
| | | [Route("JIT_DayPlanPlatFormBill/JIT_DayPlanPlatFormBillHLockedOrder")] |
| | | [HttpGet] |
| | | public object JIT_DayPlanPlatFormBillHLockedOrder(string HInterIDs) |
| | | { |
| | | try |
| | | { |
| | | oCN.RunProc($"update Sc_WorkBillSortBillMain set HLockOrder = 1 where HInterID in ({HInterIDs})"); |
| | | |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "Sucessï¼"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "Exceptionï¼" + e.ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #region ç产æ¥è®¡åå¹³å° è§£éå·¥å |
| | | [Route("JIT_DayPlanPlatFormBill/JIT_DayPlanPlatFormBillHUnlockOrder")] |
| | | [HttpGet] |
| | | public object JIT_DayPlanPlatFormBillHUnlockOrder(string HInterIDs) |
| | | { |
| | | try |
| | | { |
| | | oCN.RunProc($"update Sc_WorkBillSortBillMain set HLockOrder = 0 where HInterID in ({HInterIDs})"); |
| | | |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "Sucessï¼"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "Exceptionï¼" + e.ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #region ç产æ¥è®¡åå¹³å° çäº§è®¢åæ¥è¯¢ |
| | | [Route("JIT_DayPlanPlatFormBill/JIT_ICMOBillList")] |
| | | [HttpGet] |
| | |
| | | { |
| | | try |
| | | { |
| | | //è·åæ¾ç¤ºç³»ç»åæ° |
| | | string sReturn = ""; |
| | | oSystemParameter.ShowBill(ref sReturn); |
| | | |
| | | //æ¥è¯¢éæ©è½¦é´ä¸æªæäº§è¿çç产订åä¿¡æ¯ï¼æ·»åº·ç§æ--ç产订åç¶æä¸ºä¸è¾¾ï¼ |
| | | ds = oCN.RunProcReturn($"exec h_p_JIT_ICMOBillListByDept '{HDeptID}'", "h_p_JIT_ICMOBillListByDept"); |
| | | |
| | | if (ds.Tables[0].Rows.Count > 0 && ds != null) |
| | | { |
| | | //æ°æ®è¡¨æ ¼æ·»å å¨ææ¥æ |
| | | for (int j = 1; j <= 31; j++) |
| | | if (oSystemParameter.omodel.WMS_CampanyName == "æ·»åº·ç§æ") //ç³»ç»åæ° å®¢æ·å®å¶ååç§° 空ç½ä¸ºéç¨ |
| | | { |
| | | ds.Tables[0].Columns.Add(DateTime.Now.AddDays(j - 1).ToString("yyyy-MM-dd"), typeof(Int32)); |
| | | //æ°æ®è¡¨æ ¼æ·»å å¨ææ¥æ |
| | | for (int j = 1; j <= 180; j++) |
| | | { |
| | | ds.Tables[0].Columns.Add(DateTime.Now.AddDays(j - 1).ToString("yyyy-MM-dd"), typeof(Int32)); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | //æ°æ®è¡¨æ ¼æ·»å å¨ææ¥æ |
| | | for (int j = 1; j <= 31; j++) |
| | | { |
| | | ds.Tables[0].Columns.Add(DateTime.Now.AddDays(j - 1).ToString("yyyy-MM-dd"), typeof(Int32)); |
| | | } |
| | | } |
| | | |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #region ç产æ¥è®¡åå¹³å° è·åå®å·¥æ¥æ |
| | | [Route("JIT_DayPlanPlatFormBill/GetICMOCompletionDate")] |
| | | [HttpGet] |
| | | public object GetICMOCompletionDate(string HDeptID) |
| | | { |
| | | try |
| | | { |
| | | //æ´æ°æ¥è®¡åå·¥åçå®å·¥æ¥æ |
| | | oCN.RunProc($"exec h_p_JIT_GetICMOCompletionDate '{HDeptID}'"); |
| | | |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "è·åå®å·¥æ¥ææåï¼"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "Exceptionï¼" + e.ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #region ç产æ¥è®¡åå¹³å° è·åææ©å¼å·¥æ¥æ |
| | | [Route("JIT_DayPlanPlatFormBill/GetICMOEarlyDate")] |
| | | [HttpGet] |
| | | public object GetICMOEarlyDate(string HDeptID) |
| | | { |
| | | try |
| | | { |
| | | //æ´æ°ç产订åçææ©å¼å·¥æ¥æ |
| | | oCN.RunProc($"exec h_p_JIT_GetICMOEarlyDate '{HDeptID}'"); |
| | | |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "è·åææ©å¼å·¥æ¥ææåï¼"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "Exceptionï¼" + e.ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #region éè¿ç©æå¹é
产åå¨å
·æ¸
å |
| | | [Route("JIT_DayPlanPlatFormBill/GetMouldByMater")] |
| | | [HttpGet] |
| | | public object GetMouldByMater(string HMaterID,string HSourceID) |
| | | { |
| | | try |
| | | { |
| | | ds = oCN.RunProcReturn("exec h_p_Gy_MaterialMouldByMater " + HMaterID + "," + HSourceID, "h_p_Gy_MaterialMouldByMater"); |
| | | |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "Sucessï¼"; |
| | | objJsonResult.data = ds.Tables[0]; |
| | | return objJsonResult; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "Exceptionï¼" + e.ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #region éè¿èµæºå¹é
èµæºå¨å
·æ¸
å |
| | | [Route("JIT_DayPlanPlatFormBill/GetMouldBySource")] |
| | | [HttpGet] |
| | | public object GetMouldBySource(string HSourceID, string HMouldID) |
| | | { |
| | | try |
| | | { |
| | | ds = oCN.RunProcReturn("select * from h_v_Gy_SourceMouldBillMainList where HSourceID = " + HSourceID + " and HMouldID = " + HMouldID, "h_v_Gy_SourceMouldBillMainList"); |
| | | |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "Sucessï¼"; |
| | | objJsonResult.data = ds.Tables[0]; |
| | | return objJsonResult; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "Exceptionï¼" + e.ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #region æäº§åå°å¨å
·å ç¨æ¶é´åå
¥æ°æ®åº |
| | | [Route("JIT_DayPlanPlatFormBill/AddMouldOccupancyTime")] |
| | | [HttpGet] |
| | | public object AddMouldOccupancyTime(string HMouldID, string HSourceID, string HICMOInterID, string HICMOEntryID, string HMouldPCTime) |
| | | { |
| | | try |
| | | { |
| | | ds = oCN.RunProcReturn("exec h_p_JIT_AddMouldOccupancyTime " + HMouldID + "," + HSourceID + "," + HICMOInterID + "," + HICMOEntryID + ",'" + HMouldPCTime + "'", "h_p_JIT_AddMouldOccupancyTime"); |
| | | |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "Sucessï¼"; |
| | | objJsonResult.data = ds.Tables[0]; |
| | | return objJsonResult; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "Exceptionï¼" + e.ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | } |
| | | } |