| | |
| | | using Newtonsoft.Json.Linq; |
| | | using Newtonsoft.Json; |
| | | using Newtonsoft.Json.Linq; |
| | | using NPOI.HSSF.UserModel; |
| | | using NPOI.SS.UserModel; |
| | | using Pub_Class; |
| | |
| | | { |
| | | try |
| | | { |
| | | LogService.Write("æ§è¡äº0"); |
| | | //夿æ¯å¦ææ¥è¯¢æé |
| | | if (!DBUtility.ClsPub.Security_Log("MES_MESBeginWorkBill_Query", 1, false, user)) |
| | | { |
| | |
| | | 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"); |
| | | } |
| | | |
| | |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #region æ¥å·¥å¹³å°å¼å·¥åæ«äºç»´ç æ¥è¯¢ |
| | | [Route("Sc_MESBeginStepWorkBill/GetMESBeginStepWorkBillByEWM")] |
| | | [HttpGet] |
| | | public object GetMESBeginStepWorkBillByEWM(string sBillBarCode) |
| | | { |
| | | try |
| | | { |
| | | //æ ¹æ®éæ©èµæºIDè·åå½åç产工åã责任人 |
| | | ds = oCN.RunProcReturn("select * from h_v_IF_ICMOBillList where åæ®å·='"+ 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; |
| | | long EntyID = 0; |
| | | 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; |
| | | } |
| | | } |
| | | |
| | | 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(); |
| | | bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); |
| | | //访é®éè¶ |
| | | 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 = MainId, |
| | | PkEntryIds = EntyID |
| | | }; |
| | | var result = InvokeHelper.ExcuteOperation("PRD_MO", "ToStart", JsonConvert.SerializeObject(json)); |
| | | if (JObject.Parse(result)["Result"]["ResponseStatus"]["IsSuccess"].ToString().ToUpper() != "TRUE") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "对åºéè¶äºçäº§è®¢åæ´æ¹å¼å·¥ç¶æå¤±è´¥ï¼" + result; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | 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 |
| | | } |
| | | } |