| | |
| | | using Newtonsoft.Json.Linq; |
| | | using Newtonsoft.Json; |
| | | using Newtonsoft.Json.Linq; |
| | | using NPOI.HSSF.UserModel; |
| | | using NPOI.SS.UserModel; |
| | | using Pub_Class; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Data; |
| | | using System.IO; |
| | | using System.Linq; |
| | | using System.Net; |
| | | using System.Net.Http; |
| | | using System.Net.Http.Headers; |
| | | using System.Web.Http; |
| | | using WebAPI.Models; |
| | | |
| | |
| | | |
| | | [Route("Sc_MESBeginStepWorkBill/GetMESBeginStepWorkBill")] |
| | | [HttpGet] |
| | | public object GetMESBeginStepWorkBill(string sWhere) |
| | | public object GetMESBeginStepWorkBill(string sWhere, string user) |
| | | { |
| | | try |
| | | { |
| | | |
| | | LogService.Write("æ§è¡äº0"); |
| | | //夿æ¯å¦ææ¥è¯¢æé |
| | | if (!DBUtility.ClsPub.Security_Log("MES_MESBeginWorkBill_Query", 1, false, user)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "æ æ¥è¯¢æé!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | LogService.Write("æ§è¡äº"); |
| | | ds = Sc_GetMESBeginStepWorkBill(sWhere); |
| | | |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "è¿åè®°å½æåï¼"; |
| | |
| | | { |
| | | if (sWhere == null || sWhere.Equals("")) |
| | | { |
| | | return new SQLHelper.ClsCN().RunProcReturn("select * from h_v_Sc_MESBeginWorkBillList_NEW ", "h_v_Sc_MESBeginWorkBillList_NEW"); |
| | | return new SQLHelper.ClsCN().RunProcReturn("select * from h_v_Sc_MESBeginWorkBillList_NEW order by hmainid desc ", "h_v_Sc_MESBeginWorkBillList_NEW"); |
| | | } |
| | | else |
| | | { |
| | | LogService.Write("æ§è¡äº1"); |
| | | string sql1 = "select * from h_v_Sc_MESBeginWorkBillList_NEW where 1 = 1 "; |
| | | string sql = sql1 + sWhere; |
| | | string sql = sql1 + sWhere + " order by hmainid desc "; |
| | | return new SQLHelper.ClsCN().RunProcReturn(sql, "h_v_Sc_MESBeginWorkBillList_NEW"); |
| | | } |
| | | |
| | |
| | | { |
| | | DBUtility.ClsPub.CurUserName = UserName; |
| | | //ç¼è¾æé |
| | | if (!DBUtility.ClsPub.Security_Log_second("MES_MESBeginWorkBill_Delete", 1, true, DBUtility.ClsPub.CurUserName)) |
| | | if (!DBUtility.ClsPub.Security_Log_second("MES_MESBeginWorkBill_Drop", 1, false, DBUtility.ClsPub.CurUserName)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | |
| | | try |
| | | { |
| | | //å®¡æ ¸æé |
| | | if (!DBUtility.ClsPub.Security_Log_second(ModRightNameCheck, 1, true, CurUserName)) |
| | | if (!DBUtility.ClsPub.Security_Log_second(ModRightNameCheck, 1, false, CurUserName)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | |
| | | string refSav = sArray[2].ToString(); |
| | | DBUtility.ClsPub.CurUserName = UserName; |
| | | //ä¿åæé |
| | | if (!DBUtility.ClsPub.Security_Log_second("MES_MESBeginWorkBill_Edit", 1, true, DBUtility.ClsPub.CurUserName)) |
| | | if (!DBUtility.ClsPub.Security_Log_second("MES_MESBeginWorkBill_Edit", 1, false, DBUtility.ClsPub.CurUserName)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | |
| | | |
| | | public static DataSet Sc_GetMESProductReportBillList(string sWhere) |
| | | { |
| | | //string sql = string.Format(@"select a.HInterID, a.HBillNo,a.HDate,a.HBillType,a.HBillStatus,a.HMaterID,m.HNumber HMaterCode,m.HName HMaterName,m.HModel HMaterSpec |
| | | // ,b.HSourceID,s.HNumber HSourceCode,s.HName HSourceName,a.HGroupID,g.HNumber HGroupCode,g.HName HGroupName |
| | | // ,b.HEmpID,b.HEmpNumber,e.HName HEmpName,a.HMaker,a.HMakeDate, 'å·¥åºæ±æ¥' HReportType |
| | | // ,b.HQty,a.HICMOBillNo,a.HICMOInterID,pr.HProcNo,b.HProcID,p.HNumber HProcNumber,p.HName HProcName |
| | | // ,b.HSourceInterID,b.HSourceEntryID,b.HSourceBillNo,b.HSourceBillType |
| | | // from Sc_ProcessReportMain a |
| | | // inner join Sc_ProcessReportSub b on a.HInterID=B.HInterID |
| | | // inner join (select max(HProcNo) HProcNo,max(HProcID) HProcID |
| | | // from Sc_ProcessPlanSub group by HBillNo,HSourceBillNo) |
| | | // pr on b.HProcID=pr.HProcID |
| | | // left join Gy_Process p on b.HProcID=p.HItemID |
| | | // left join Gy_Material m on a.HMaterID=m.hitemid |
| | | // left join Gy_Source s on b.HSourceID=s.HItemID |
| | | // left join Gy_Group g on a.HGroupID=g.HItemID |
| | | // left join Gy_Employee e on b.HEmpID=e.HItemID " + sWhere+" and HRelationInterID='0'"); |
| | | string sql = string.Format(@"select a.HInterID, a.HBillNo,a.HDate,a.HBillType,a.HBillStatus,a.HMaterID,m.HNumber HMaterCode,m.HName HMaterName,m.HModel HMaterSpec |
| | | ,b.HSourceID,s.HNumber HSourceCode,s.HName HSourceName,a.HGroupID,g.HNumber HGroupCode,g.HName HGroupName |
| | | ,b.HEmpID,b.HEmpNumber,e.HName HEmpName,a.HMaker,a.HMakeDate, 'å·¥åºæ±æ¥' HReportType |
| | | ,b.HQty,a.HICMOBillNo,a.HICMOInterID,pr.HProcNo,b.HProcID,p.HNumber HProcNumber,p.HName HProcName |
| | | ,b.HSourceInterID,b.HSourceEntryID,b.HSourceBillNo,b.HSourceBillType |
| | | from Sc_ProcessReportMain a |
| | | inner join Sc_ProcessReportSub b on a.HInterID=B.HInterID |
| | | inner join (select max(HProcNo) HProcNo,HBillNo,HProcID,HSourceInterID,HSourceEntryID,HSourceBillNo |
| | | from Sc_ProcessPlanSub group by HBillNo,HProcID,HSourceInterID,HSourceEntryID,HSourceBillNo) |
| | | pr on b.HSourceBillNo=pr.HSourceBillNo and b.HSourceInterID=pr.HSourceInterID and b.HSourceEntryID=pr.HSourceEntryID |
| | | left join Gy_Process p on b.HProcID=p.HItemID |
| | | left join Gy_Material m on a.HMaterID=m.hitemid |
| | | left join Gy_Source s on b.HSourceID=s.HItemID |
| | | left join Gy_Group g on a.HGroupID=g.HItemID |
| | | left join Gy_Employee e on b.HEmpID=e.HItemID "+sWhere+" and HRelationInterID='0'"); |
| | | ,a.HSourceID,s.HNumber HSourceCode,s.HName HSourceName,a.HGroupID,g.HNumber HGroupCode,g.HName HGroupName |
| | | ,a.HWorkManID,e.HName HWorkManName,a.HMaker,a.HMakeDate, a.HReportType |
| | | ,a.HQty,a.HICMOBillNo,a.HICMOInterID,a.HICMOEntryID,pr.HProcNo,a.HProcID,p.HNumber HProcNumber,p.HName HProcName |
| | | ,a.HSourceInterID,a.HSourceEntryID,a.HSourceBillNo, a.HSourceBillType |
| | | from Sc_ICMOBillWorkQtyStatus_Tmp a |
| | | inner join (select max(HProcNo) HProcNo,max(HProcID) HProcID |
| | | from Sc_ProcessPlanSub group by HBillNo,HSourceBillNo) |
| | | pr on a.HProcID=pr.HProcID |
| | | left join Gy_Process p on a.HProcID=p.HItemID |
| | | left join Gy_Material m on a.HMaterID=m.hitemid |
| | | left join Gy_Source s on a.HSourceID=s.HItemID |
| | | left join Gy_Group g on a.HGroupID=g.HItemID |
| | | left join Gy_Employee e on a.HWorkManID=e.HItemID " + sWhere + " and HRelationInterID='0'"); |
| | | return new SQLHelper.ClsCN().RunProcReturn(sql, "Sc_ICMOBillWorkQtyStatus_Tmp"); |
| | | } |
| | | #endregion |
| | |
| | | { |
| | | try |
| | | { |
| | | ds = new SQLHelper.ClsCN().RunProcReturn("select isnull(sum(HQty),0) HQty,isnull(sum(HBadQty),0) HBadQty,isnull(sum(HWasterQty),0) HWasterQty from Sc_ProcessReportSub with (nolock)" + sWhere, "Sc_ProcessReportSub"); |
| | | //ds = new SQLHelper.ClsCN().RunProcReturn("select isnull(sum(HQty),0) HQty,isnull(sum(HBadCount),0) HBadQty,isnull(sum(HWasterQty),0) HWasterQty from Sc_ProcessReportSub with (nolock)" + sWhere, "Sc_ProcessReportSub"); |
| | | ds = new SQLHelper.ClsCN().RunProcReturn("select isnull(sum(HQty),0) HQty,isnull(sum(HBadQty),0) HBadQty,isnull(sum(HWasterQty),0) HWasterQty from Sc_ICMOBillWorkQtyStatus_Tmp with (nolock)" + sWhere, "Sc_ICMOBillWorkQtyStatus_Tmp"); |
| | | if (ds.Tables[0].Rows.Count > 0) |
| | | { |
| | | objJsonResult.code = "1"; |
| | |
| | | /// </summary> |
| | | /// <param name="msg"></param> |
| | | /// <returns></returns> |
| | | [Route("Sc_MESBeginStepWorkBill/SaveGetMESProductReportFrom")] |
| | | [Route("Sc_MESBeginStepWorkBill/SaveGetMESProductReportFromxxx")] |
| | | [HttpPost] |
| | | public object SaveGetMESProductReportFrom([FromBody] JObject msg) |
| | | public object SaveGetMESProductReportFromxxx([FromBody] JObject msg) |
| | | { |
| | | var _value = msg["msg"].ToString(); |
| | | string msg1 = _value.ToString(); |
| | |
| | | oItemSub.HCloseType = false; //å
³éç±»å |
| | | //oItemSub.HRemark = ""; //夿³¨ |
| | | oItemSub.HRelationQty = 0; //å
³èæ°é |
| | | oItemSub.HProcPlanBillNo = ""; //å·¥åºè®¡åå |
| | | oItemSub.HSeOrderBillNo = ""; |
| | | oItemSub.HRemark = "æ¥å·¥å°å·¥åºæ±æ¥"; |
| | | oItemSub.HOtherItem1 = ""; |
| | | oItemSub.HOtherItem2 = ""; |
| | | oItemSub.HOtherItem3 = ""; |
| | | oItemSub.HOtherItem4 = ""; |
| | | oItemSub.HOtherItem5 = ""; |
| | | oItemSub.HPackType = ""; |
| | | oItemSub.HBatchNo = ""; |
| | | //oItemSub.HRelationMoney = 0; //å
³èéé¢ |
| | | //oItemSub.HRepairID = 0; //ç»´ä¿®é¡¹ç® |
| | | //oItemSub.HRepairExplanation =""; //ç»´ä¿®è¦æ± |
| | |
| | | /// <param name="IsAudit">å®¡æ ¸(0),åå®¡æ ¸(1)</param> |
| | | /// <param name="CurUserName">å®¡æ ¸äºº</param> |
| | | /// <returns></returns> |
| | | [Route("Sc_MESBeginStepWorkBill/MESProductAuditProcessReportList")] |
| | | [Route("Sc_MESBeginStepWorkBill/MESProductAuditProcessReportListxxxx")] |
| | | [HttpGet] |
| | | public object MESProductAuditProcessReportList(int HSourceID, int HSourceInterID, int HSourceEntryID, string HSourceBillNo, int HICMOInterID, int HICMOEntryID, int HInterID, int IsAudit, string CurUserName) |
| | | public object MESProductAuditProcessReportListxxxx(int HSourceID, int HSourceInterID, int HSourceEntryID, string HSourceBillNo, int HICMOInterID, int HICMOEntryID, int HInterID, int IsAudit, string CurUserName) |
| | | { |
| | | string ModRightNameCheck = "MES_ProductReport_Check"; |
| | | DBUtility.ClsPub.CurUserName = CurUserName; |
| | |
| | | { |
| | | string StrMessage = ""; |
| | | //å®¡æ ¸æé |
| | | if (!WebClsPub.Security_Log(ModRightNameCheck, 1, true, CurUserName, ref StrMessage)) |
| | | if (!WebClsPub.Security_Log(ModRightNameCheck, 1, false, CurUserName, ref StrMessage)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | |
| | | { |
| | | try |
| | | { |
| | | //夿æ¯å¦æå 餿é |
| | | if (!DBUtility.ClsPub.Security_Log("MES_ProcExchReport_Drop", 1, false, UserName)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "æ æéå é¤!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | oCN.BeginTran(); |
| | | //å é¤å·¥åºæ±æ¥å表 |
| | | string sql1 = string.Format(@"delete Sc_ProcessReportSub where HInterID='"+HInterID+"' and HICMOInterID='" + HICMOInterID + "' and HICMOEntryID='" + HICMOEntryID + "'"); |
| | | oCN.RunProc(sql1); |
| | | //å é¤å·¥åºæ±æ¥ä¸»è¡¨ |
| | | string sql = string.Format(@"delete Sc_ProcessReportMain where HInterID='" + HInterID + "'"); |
| | | |
| | | //å é¤äº§éæ±æ¥è¡¨ |
| | | string sql = string.Format(@"delete Sc_ICMOBillWorkQtyStatus_Tmp where HInterID='" + HInterID + "'"); |
| | | oCN.RunProc(sql); |
| | | |
| | | oCN.Commit(); |
| | |
| | | #region æ¥å·¥å¹³å°æ¥æ£ç³è¯·ä¿å |
| | | [Route("Sc_MESBeginStepWorkBill/SaveGetMESProductReportBillList")] |
| | | [HttpGet] |
| | | public object SaveGetMESProductReportBillList(string ScMaxWork, string HSourceBillType, string workcode, int HSourceID, int HICMOInterID, int HICMOEntryID, string HMaker, string Czybm,string HProcID) |
| | | public object SaveGetMESProductReportBillList(string ScMaxWork, string HSourceBillType, string workcode, int HSourceID, int HICMOInterID, int HICMOEntryID, string HMaker, string Czybm, string HProcID) |
| | | { |
| | | ListModels oListModels = new ListModels(); |
| | | try |
| | |
| | | //} |
| | | |
| | | string sHSourceType = HSourceBillType; |
| | | string BillType = "3711"; //åæ®ç±»å (çäº§æ±æ¥å) |
| | | string BillType = "3714"; //åæ®ç±»å (å·¥åºæ±æ¥å) |
| | | //å¾å°mainid |
| | | long HInterID = DBUtility.ClsPub.CreateBillID(BillType, ref DBUtility.ClsPub.sExeReturnInfo); |
| | | //oCN.BeginTran(); |
| | |
| | | // return objJsonResult; |
| | | //} |
| | | |
| | | |
| | | WebS.ClsSc_ICMOReportBillMain model = new WebS.ClsSc_ICMOReportBillMain(); |
| | | model.HInterID = HInterID; |
| | | model.HBillNo = ScMaxWork; |
| | |
| | | model.HDate = DateTime.Now; |
| | | model.HRemark = ""; |
| | | model.HMaker = HMaker; |
| | | model.HEmpID = 0; |
| | | model.HEmpID = int.Parse(Czybm.ToString()); |
| | | //model.HGroupID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[0]["HGroupID"]); |
| | | //model.HDeptID= DBUtility.ClsPub.isLong(ds0.Tables[0].Rows[0]["HDeptID"]); |
| | | //model.HPRDORGID = DBUtility.ClsPub.isLong(ds0.Tables[0].Rows[0]["HPRDORGID"]); |
| | | model.HMainSourceInterID = HICMOInterID; |
| | | model.HMainSourceEntryID = HICMOEntryID; |
| | | |
| | | |
| | | //oWebs.Timeout = 30000; |
| | | bool flag = oWebs.set_SaveICMOProductReportBill_LayuiYqn(model, workcode, HSourceID, sHSourceType, HProcID, ref DBUtility.ClsPub.sErrInfo); |
| | |
| | | } |
| | | #endregion |
| | | |
| | | |
| | | #region æ¥å·¥å¹³å°(å·¥åº)äº§éæ±æ¥ä¿å/ç¼è¾--æ° |
| | | /// <summary> |
| | | /// æ¥å·¥å¹³å°(å·¥åº)äº§éæ±æ¥ |
| | | /// </summary> |
| | | /// <param name="msg"></param> |
| | | /// <returns></returns> |
| | | [Route("Sc_MESBeginStepWorkBill/SaveGetMESProductReportFrom")] |
| | | [HttpPost] |
| | | public object SaveGetMESProductReportFrom([FromBody] JObject msg) |
| | | { |
| | | var _value = msg["msg"].ToString(); |
| | | string msg1 = _value.ToString(); |
| | | string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries); |
| | | string msg2 = sArray[0].ToString(); |
| | | string refSav = sArray[1].ToString(); |
| | | string user = sArray[2].ToString();//ç¨æ·å |
| | | string s = ""; |
| | | ListModels oListModels = new ListModels(); |
| | | try |
| | | { |
| | | //夿æ¯å¦æç¼è¾æé |
| | | if (!DBUtility.ClsPub.Security_Log("MES_ProcExchReport_Edit", 1, false, user)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "æ æéç¼è¾!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | DLL.ClsSc_ICMOStepBillWorkQtyStatus_Tmp oBill = new DLL.ClsSc_ICMOStepBillWorkQtyStatus_Tmp(); |
| | | List<Models.ClsSc_ICMOBillWorkQtyStatus_Tmp> lsmain = new List<Models.ClsSc_ICMOBillWorkQtyStatus_Tmp>(); |
| | | msg2 = msg2.Replace("\\", ""); |
| | | msg2 = msg2.Replace("\n", ""); //\n |
| | | lsmain = oListModels.getObjectByJson_Gy_MESProductReportFrom(msg2); |
| | | foreach (Models.ClsSc_ICMOBillWorkQtyStatus_Tmp oItem in lsmain) |
| | | { |
| | | if (refSav == "Add") |
| | | { |
| | | //忮巿¯å¦éå¤ |
| | | if (BillNew1.IsExistBillNo(ref ClsPub.sExeReturnInfo, oItem.HBillNo, BillStatus, BillOld1.omodel.HInterID)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "åæ®å·éå¤ï¼ä¸å
许ä¿åï¼"; |
| | | objJsonResult.data = 1; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | if (refSav == "Update") |
| | | { |
| | | if (BillOld1.ShowBill(oItem.HInterID, ref s) == false) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "æ¤åæ®æè¯¯ï¼"; |
| | | objJsonResult.data = 1; |
| | | return objJsonResult; |
| | | } |
| | | //夿æ¯å¦å¯ç¼è¾ |
| | | if (BillOld1.omodel.HChecker != "" && BillOld1.omodel.HChecker != null) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "æ¤åæ®å·²ç»è¢«å®¡æ ¸ï¼ä¸å
许修æ¹ï¼"; |
| | | objJsonResult.data = 1; |
| | | return objJsonResult; |
| | | } |
| | | if (BillOld1.omodel.HBillStatus > 1) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "æ¤åæ®å¤äºä¸å¯ç¼è¾ç¶æï¼ä¸å
许修æ¹ï¼"; |
| | | objJsonResult.data = 1; |
| | | return objJsonResult; |
| | | } |
| | | if (!DBUtility.Xt_BaseBillFun.Fun_AllowEditBill(BillOld1, ref s)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = s + "ï¼ä¸å
许修æ¹"; |
| | | objJsonResult.data = 1; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | |
| | | oItem.HBillType = "3724"; |
| | | oItem.HBillSubType = "3724"; |
| | | oItem.HReportType = 3;//ï¼1æ¡ç æ«æï¼2æºå¨æ±æ¥ï¼3æå·¥å½å
¥ï¼ |
| | | oItem.HBillStatus = 1; //åæ®ç¶æï¼1æªå®¡ï¼2å®¡æ ¸éè¿ï¼3å
³éï¼4ä½åºï¼5å®¡æ ¸éå,6å®¡æ ¸ä¸,7å·²é
ï¼8å·²åå¤ï¼9ç»æ¡ï¼10éªè¯,11ä¸è¾¾ï¼12å¼å·¥,13ç³è¯·å®¡æ¹,15ç³è¯·æ£éªï¼16 å¤å®åæ ¼ï¼17å¤å®ä¸åæ ¼ï¼ |
| | | if (DBUtility.ClsPub.isStrNull(oItem.HDate) == "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "ä¿åå¤±è´¥ï¼æ²¡æåæ®æ¥æï¼æ æ³ä¿åï¼"; |
| | | objJsonResult.data = 1; |
| | | return objJsonResult; |
| | | } |
| | | oBill.omodel = oItem; |
| | | } |
| | | |
| | | //ä¿å |
| | | //ä¿å宿¯åå¤ç |
| | | bool bResult; |
| | | if (oBill.omodel.HInterID == 0) |
| | | { |
| | | bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); |
| | | if (bResult) |
| | | { |
| | | objJsonResult.HInterID = DBUtility.ClsPub.sExeReturnInfo; //è¿å主ID |
| | | //ç³»ç»åæ° èªå¨å®¡æ ¸ |
| | | string sReturn = ""; |
| | | if (oSystemParameter.ShowBill(ref sReturn) == true) |
| | | { |
| | | if (oSystemParameter.omodel.Sc_ICMOBillWorkQtyStatus_AutoCheck == "Y") //ç³»ç»åæ° èªå¨å®¡æ ¸ |
| | | { |
| | | objJsonResult.Verify = "Y"; |
| | | } |
| | | else |
| | | { |
| | | objJsonResult.Verify = "N"; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | bResult = oBill.ModifyBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo); |
| | | objJsonResult.Verify = "N"; |
| | | } |
| | | if (bResult) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "ä¿åæåï¼"; |
| | | objJsonResult.data = 1; |
| | | return objJsonResult; |
| | | } |
| | | else |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "ä¿å失败ï¼"; |
| | | objJsonResult.data = 1; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = e.Message; |
| | | objJsonResult.data = 1; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #region æ¥å·¥å¹³å°äº§éæ±æ¥å®¡æ ¸ãåå®¡æ ¸ |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | /// <param name="HInterID">忮ID</param> |
| | | /// <param name="IsAudit">å®¡æ ¸(0),åå®¡æ ¸(1)</param> |
| | | /// <param name="CurUserName">å®¡æ ¸äºº</param> |
| | | /// <returns></returns> |
| | | [Route("Sc_MESBeginStepWorkBill/MESProductAuditProcessReportList")] |
| | | [HttpGet] |
| | | public object MESProductAuditProcessReportList(int HSourceID, int HSourceInterID, int HSourceEntryID, string HSourceBillNo, int HICMOInterID, int HICMOEntryID, int HInterID, int IsAudit, string CurUserName) |
| | | { |
| | | string ModRightNameCheck = "MES_ProcExchReport_Check"; |
| | | DBUtility.ClsPub.CurUserName = CurUserName; |
| | | try |
| | | { |
| | | string StrMessage = ""; |
| | | //å®¡æ ¸æé |
| | | if (!WebClsPub.Security_Log(ModRightNameCheck, 1, false, CurUserName, ref StrMessage)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = StrMessage; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | if (HInterID <= 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "HInterIDå°äº0ï¼"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | Int64 lngBillKey = 0; |
| | | lngBillKey = DBUtility.ClsPub.isLong(HInterID); |
| | | DLL.ClsSc_ICMOStepBillWorkQtyStatus_Tmp oBill = new DLL.ClsSc_ICMOStepBillWorkQtyStatus_Tmp(); |
| | | //æ¥çæ¯å¦å·²å®¡æ ¸,å
³é,ä½åº |
| | | if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo)) |
| | | { |
| | | if (oBill.omodel.HCloseMan.Trim() != "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "忮已å
³é!ä¸è½åæ¬¡å®¡æ ¸ï¼"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | if (oBill.omodel.HDeleteMan.Trim() != "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "忮已ä½åº!ä¸è½åæ¬¡å®¡æ ¸ï¼"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | if (IsAudit == 0) //å®¡æ ¸å¤æ |
| | | { |
| | | if (oBill.omodel.HChecker.Trim() != "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "åæ®å·²å®¡æ ¸!ä¸è½åæ¬¡å®¡æ ¸ï¼"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | if (IsAudit == 1) //åå®¡æ ¸å¤æ |
| | | { |
| | | if (oBill.omodel.HChecker.Trim() == "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "åæ®æªå®¡æ ¸!ä¸éè¦åå®¡æ ¸!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "åæ®ä¸åå¨!åå :" + DBUtility.ClsPub.sExeReturnInfo; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | if (IsAudit == 0) //å®¡æ ¸æäº¤ |
| | | { |
| | | //å®¡æ ¸æäº¤ |
| | | if (oBill.CheckBill(HSourceID, HSourceInterID, HSourceEntryID, HSourceBillNo, HICMOInterID, HICMOEntryID, lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo) == true) |
| | | { |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "å®¡æ ¸æå"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | else |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "å®¡æ ¸å¤±è´¥!åå :" + DBUtility.ClsPub.sExeReturnInfo; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | if (IsAudit == 1) //åå®¡æ ¸æäº¤ |
| | | { |
| | | //åå®¡æ ¸æäº¤AbandonCheck |
| | | if (oBill.AbandonCheck(HSourceID, HSourceInterID, HSourceEntryID, HSourceBillNo, HICMOInterID, HICMOEntryID, lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo) == true) |
| | | { |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "åå®¡æ ¸æå"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | else |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "åå®¡æ ¸å¤±è´¥!åå :" + DBUtility.ClsPub.sExeReturnInfo; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | return objJsonResult; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "å®¡æ ¸å¤±è´¥æè
åå®¡æ ¸å¤±è´¥ï¼" + e.ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #region æ¥å·¥å¹³å°å¼å·¥åæ«äºç»´ç æ¥è¯¢ |
| | | [Route("Sc_MESBeginStepWorkBill/GetMESBeginStepWorkBillByEWM")] |
| | | [HttpGet] |
| | | public object GetMESBeginStepWorkBillByEWM(string sBillBarCode) |
| | | { |
| | | try |
| | | { |
| | | //æ ¹æ®éæ©èµæºIDè·åå½åç产工åã责任人 |
| | | ds = oCN.RunProcReturn("select f1.F_YQN_XSDD éå®è®¢åç¼å·, f1.F_zzzz_Text4 éå®ç©æåç§°,* from h_v_IF_ICMOBillList a left join AIS20200908101915zs..T_PRD_MOENTRY f1 on a.HERPEntryID=f1.FENTRYID where convert(varchar(50),a.hmainid)+'-'+convert(varchar(50),a.HEntryID)='" + sBillBarCode + "'", "h_v_IF_ICMOBillList"); |
| | | if (ds.Tables[0].Rows.Count > 0) |
| | | { |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "è¿åæºåæåï¼"; |
| | | objJsonResult.data = ds; |
| | | return objJsonResult; |
| | | } |
| | | else |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "ææ èµæºç»å®ï¼"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = e.Message.ToString(); |
| | | objJsonResult.data = null; |
| | | |
| | | } |
| | | return objJsonResult; |
| | | } |
| | | #endregion |
| | | |
| | | #region æ¥å·¥å¹³å°å¼å·¥åæ æºåä¿å |
| | | [Route("Sc_MESBeginStepWorkBill/SaveGetMESBeginStepWorkBillByEWM")] |
| | | [HttpPost] |
| | | public object SaveGetMESBeginStepWorkBillByEWM([FromBody] JObject msg) |
| | | { |
| | | var _value = msg["msg"].ToString(); |
| | | string msg1 = _value.ToString(); |
| | | string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries); |
| | | string msg2 = sArray[0].ToString(); |
| | | string UserName = sArray[1].ToString(); |
| | | string refSav = sArray[2].ToString(); |
| | | DBUtility.ClsPub.CurUserName = UserName; |
| | | //ä¿åæé |
| | | if (!DBUtility.ClsPub.Security_Log_second("MES_MESBeginWorkBill_Edit", 1, false, DBUtility.ClsPub.CurUserName)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "æ ä¿åæéï¼"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | //夿ä¼è®¡ææ¯å¦åç |
| | | string s = ""; |
| | | int sYear = 0; |
| | | int sPeriod = 0; |
| | | string BillNo = ""; |
| | | long MainId = 0; |
| | | string EntyID = ""; |
| | | |
| | | if (DBUtility.Xt_BaseBillFun.Fun_AllowYearPeriod(DateTime.Now, ref sYear, ref sPeriod, ref s) == false) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = s; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | ListModels oListModels = new ListModels(); |
| | | try |
| | | { |
| | | DLL.ClsSc_MESBeginWorkBill oBill = new DLL.ClsSc_MESBeginWorkBill(); |
| | | List<Models.ClsSc_MESBeginWorkBillMain> lsmain = new List<Models.ClsSc_MESBeginWorkBillMain>(); |
| | | msg2 = msg2.Replace("\\", ""); |
| | | msg2 = msg2.Replace("\n", ""); //\n |
| | | lsmain = oListModels.getObjectByJson_Gy_MESBeginWorkFrom(msg2); |
| | | foreach (Models.ClsSc_MESBeginWorkBillMain oItem in lsmain) |
| | | { |
| | | if (refSav == "Add") |
| | | { |
| | | //忮巿¯å¦éå¤ |
| | | if (BillNew.IsExistBillNo(ref ClsPub.sExeReturnInfo, oItem.HBillNo, BillStatus, BillOld.omodel.HInterID)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "åæ®å·éå¤ï¼ä¸å
许ä¿åï¼"; |
| | | objJsonResult.data = 1; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | //ç产订åç¼å·ãç产订å主IDãç产订å主ID+åID |
| | | BillNo = oItem.HMainSourceBillNo; |
| | | MainId = oItem.HMainSourceInterID; |
| | | EntyID = oItem.HMainSourceEntryID; |
| | | DBUtility.ClsPub.CurUserName = oItem.HMaker; |
| | | oItem.HBillType = "3787"; |
| | | oItem.HBillSubType = "3787"; |
| | | oItem.HBillStatus = 1; //åæ®ç¶æï¼1æªå®¡ï¼2å®¡æ ¸éè¿ï¼3å
³éï¼4ä½åºï¼5å®¡æ ¸éå,6å®¡æ ¸ä¸,7å·²é
ï¼8å·²åå¤ï¼9ç»æ¡ï¼10éªè¯,11ä¸è¾¾ï¼12å¼å·¥,13ç³è¯·å®¡æ¹,15ç³è¯·æ£éªï¼16 å¤å®åæ ¼ï¼17å¤å®ä¸åæ ¼ï¼ |
| | | oItem.HYear = DBUtility.ClsPub.isLong(DateTime.Now.Year); |
| | | oItem.HMakeDate = DBUtility.ClsPub.isStrNull(DateTime.Now.ToString("yyyy-MM-dd")); |
| | | oItem.HBarCodeMakeDate = Convert.ToDateTime(DBUtility.ClsPub.isStrNull(DateTime.Now.ToString("yyyy-MM-dd"))); //æ«ææ¥æï¼å¹´-æ-æ¥-æ¶-å-ç§ï¼ |
| | | if (DBUtility.ClsPub.isStrNull(oItem.HDate) == "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "ä¿åå¤±è´¥ï¼æ²¡æåæ®æ¥æï¼æ æ³ä¿åï¼"; |
| | | objJsonResult.data = 1; |
| | | return objJsonResult; |
| | | } |
| | | oBill.omodel = oItem; |
| | | } |
| | | |
| | | bool bResult; |
| | | if (oBill.omodel.HInterID == 0) |
| | | { |
| | | oCN.BeginTran(); |
| | | |
| | | //æ ¹æ®ç产订ååIDæ¾å¯¹åºççäº§ç¨ææ¸
å |
| | | DataSet Ds = oCN.RunProcReturn("select b.FID,b.FBILLNO,b.FDOCUMENTSTATUS from Sc_ICMOBillSub a left join AIS20200908101915zs..T_PRD_PPBOM b on a.HERPEntryID=b.FMOENTRYID where a.HEntryID=" + (EntyID).Split('-')[1], "Sc_ICMOBillSub"); |
| | | //æ¥æ¾å½åç产订åæç»ç¶æ |
| | | DataSet Dss = oCN.RunProcReturn("select FSTATUS from AIS20200908101915zs..T_PRD_MOENTRY_A where FENTRYID=" + (EntyID).Split('-')[1], "AIS20200908101915zs..T_PRD_MOENTRY_A"); |
| | | //夿éè¶ç产åçç¶æä¸ä¸º4åæ§è¡å¼å·¥ |
| | | if (Dss.Tables[0].Rows[0][0].ToString() != "4") |
| | | { |
| | | oCN.RunProc("update AIS20200908101915zs..T_PRD_MOENTRY_A set FSTATUS=4,FCONVEYDATE=getdate() where FENTRYID=" + (EntyID).Split('-')[1]); |
| | | } |
| | | else |
| | | { |
| | | oCN.RollBack(); |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "忮已å¼å·¥ï¼"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | //访é®éè¶ |
| | | var loginRet = InvokeHelper.Login(); |
| | | var isSuccess = JObject.Parse(loginRet)["LoginResultType"].Value<int>(); |
| | | if (isSuccess == 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "æä½å¤±è´¥,éè¶è´¦å·ç»å½å¼å¸¸ã" + loginRet; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | var json = new |
| | | { |
| | | //CreateOrgId = 0, |
| | | //Numbers = BillNo, |
| | | Ids = Ds.Tables[0].Rows[0][0].ToString(), |
| | | //PkEntryIds = (EntyID).Split('-')[1] |
| | | }; |
| | | //LogService.Write("json=" + json); |
| | | string result1 = string.Empty; |
| | | string result2 = string.Empty; |
| | | |
| | | //夿å½åç¨çäº§ææ¸
ååç¶æââå·²å建åå
æäº¤åå®¡æ ¸ã以æäº¤ååªå®¡æ ¸--A:å建ï¼B:æäº¤,C:å®¡æ ¸,D:éæ°å®¡æ ¸ |
| | | if (Ds.Tables[0].Rows[0][2].ToString() == "A"|| Ds.Tables[0].Rows[0][2].ToString() == "D") |
| | | { |
| | | result1 = InvokeHelper.Submit("PRD_PPBOM", JsonConvert.SerializeObject(json)); |
| | | result2 = InvokeHelper.Audit("PRD_PPBOM", JsonConvert.SerializeObject(json)); |
| | | } |
| | | if (Ds.Tables[0].Rows[0][2].ToString() == "B") |
| | | { |
| | | result2 = InvokeHelper.Audit("PRD_PPBOM", JsonConvert.SerializeObject(json)); |
| | | } |
| | | LogService.Write("result2=" + result2); |
| | | //å¤æå®¡æ ¸æ¯å¦æå |
| | | if (JObject.Parse(result2)["Result"]["ResponseStatus"]["IsSuccess"].ToString().ToUpper() != "TRUE") |
| | | { |
| | | oCN.RollBack(); |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = $"对åºçäº§ç¨ææ¸
å,åå·{Ds.Tables[0].Rows[0][1].ToString()},å®¡æ ¸å¤±è´¥ï¼" + result2; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | //ä¿å |
| | | ////æ§è¡ä¿å |
| | | bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); |
| | | if (bResult) |
| | | { |
| | | objJsonResult.HInterID = DBUtility.ClsPub.sExeReturnInfo; //è¿å主ID |
| | | //ç³»ç»åæ° èªå¨å®¡æ ¸ |
| | | string sReturn = ""; |
| | | if (oSystemParameter.ShowBill(ref sReturn) == true) |
| | | { |
| | | if (oSystemParameter.omodel.Sc_ICMOBillWorkQtyStatus_AutoCheck == "Y") //ç³»ç»åæ° èªå¨å®¡æ ¸ |
| | | { |
| | | objJsonResult.Verify = "Y"; |
| | | } |
| | | else |
| | | { |
| | | objJsonResult.Verify = "N"; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | oCN.Commit(); |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "ä¿åæåï¼"; |
| | | objJsonResult.data = 1; |
| | | return objJsonResult; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | oCN.RollBack(); |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = e.Message; |
| | | objJsonResult.data = 1; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | #endregion |
| | | } |
| | | } |
| | | } |