|  |  | 
 |  |  | using Newtonsoft.Json.Linq; | 
 |  |  | using System.Diagnostics; | 
 |  |  | using System.Threading; | 
 |  |  |  | 
 |  |  | using System.Globalization; | 
 |  |  | namespace WebAPI.Controllers.SCGL.æ¥è®¡å管ç | 
 |  |  | { | 
 |  |  |     public class JIT_DayPlanPlatFormBillController : ApiController | 
 |  |  | 
 |  |  |  | 
 |  |  |                     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 == "æ·»åº·ç§æ") //ç³»ç»åæ°  å®¢æ·å®å¶ååç§°     ç©ºç½ä¸ºéç¨ | 
 |  |  |                     { | 
 |  |  | 
 |  |  |                             } | 
 |  |  |                         } | 
 |  |  |                         //ä¸»è¡¨ææ°æ® åè¡¨æ æ°æ® | 
 |  |  |                         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]); | 
 |  |  | 
 |  |  |                     { | 
 |  |  |                         sqlName = "AIS20240809105013"; | 
 |  |  |                     } | 
 |  |  |                     else if (oSystemParameter.omodel.WMS_CampanyName == "å®å·¥") | 
 |  |  |                     { | 
 |  |  |                         sqlName = "AIS20250102123554"; | 
 |  |  |                     } | 
 |  |  |                     else | 
 |  |  |                     { | 
 |  |  |                         sqlName = "AIS20210811135644"; | 
 |  |  |                     } | 
 |  |  |                 } | 
 |  |  |  | 
 |  |  |  | 
 |  |  |                 if (HTLType == "缺æ") | 
 |  |  |                 { | 
 |  |  | 
 |  |  |         } | 
 |  |  |         #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 | 
 |  |  |  | 
 |  |  |         #region å·¥åºè´è·åææ±æ»æ¥è¡¨ æ¥è¯¢ | 
 |  |  |         /// <summary> | 
 |  |  |         /// è¿å项ç®é¶æ®µå表 | 
 |  |  |         ///åæ°ï¼string sqlã | 
 |  |  |         ///è¿åå¼ï¼objectã | 
 |  |  |         /// </summary> | 
 |  |  |         [Route("JIT_DayPlanPlatFormBill/JIT_FuHeFenXiReport")] | 
 |  |  |         [HttpGet] | 
 |  |  |         public object JIT_FuHeFenXiReport(string sWhere, string user) | 
 |  |  |         { | 
 |  |  |             try | 
 |  |  |             { | 
 |  |  |                 List<object> columnNameList = new List<object>(); | 
 |  |  |                 string sql = "exec h_p_JIT_FuHeFenXiReport   '" + sWhere + "','" + user + "'"; | 
 |  |  |  | 
 |  |  |                 ds = oCN.RunProcReturn(sql, "h_p_JIT_FuHeFenXiReport"); | 
 |  |  |  | 
 |  |  |                 //æ·»å åå | 
 |  |  |                 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; | 
 |  |  |                 return objJsonResult; | 
 |  |  |             } | 
 |  |  |             catch (Exception e) | 
 |  |  |             { | 
 |  |  |                 objJsonResult.code = "0"; | 
 |  |  |                 objJsonResult.count = 0; | 
 |  |  |                 objJsonResult.Message = "Exceptionï¼" + e.ToString(); | 
 |  |  |                 objJsonResult.data = null; | 
 |  |  |                 return objJsonResult; | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |         #endregion | 
 |  |  |  | 
 |  |  |     } | 
 |  |  | } |