From 06d732de3d904d6db368d051d61e28eb45e01b1c Mon Sep 17 00:00:00 2001 From: zzr99 <1940172413@qq.com> Date: 星期五, 10 十二月 2021 17:39:59 +0800 Subject: [PATCH] 返工单 --- WebAPI/Controllers/生产管理/报工台工序/Sc_MESReturnStepWorkBillController.cs | 192 ++++++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 185 insertions(+), 7 deletions(-) diff --git "a/WebAPI/Controllers/\347\224\237\344\272\247\347\256\241\347\220\206/\346\212\245\345\267\245\345\217\260\345\267\245\345\272\217/Sc_MESReturnStepWorkBillController.cs" "b/WebAPI/Controllers/\347\224\237\344\272\247\347\256\241\347\220\206/\346\212\245\345\267\245\345\217\260\345\267\245\345\272\217/Sc_MESReturnStepWorkBillController.cs" index df6ff46..17f5d92 100644 --- "a/WebAPI/Controllers/\347\224\237\344\272\247\347\256\241\347\220\206/\346\212\245\345\267\245\345\217\260\345\267\245\345\272\217/Sc_MESReturnStepWorkBillController.cs" +++ "b/WebAPI/Controllers/\347\224\237\344\272\247\347\256\241\347\220\206/\346\212\245\345\267\245\345\217\260\345\267\245\345\272\217/Sc_MESReturnStepWorkBillController.cs" @@ -1,4 +1,6 @@ -锘縰sing System; +锘縰sing DBUtility; +using Newtonsoft.Json.Linq; +using System; using System.Collections.Generic; using System.Data; using System.Linq; @@ -72,17 +74,17 @@ #endregion #region[杩斿伐鍗曠紪杈戞椂鑾峰彇琛ㄥご鏁版嵁] - [Route("Sc_MESBeginStepWorkBill/Sc_MESBeginStepWorkBillListCheckDetai")] + [Route("Sc_MESReturnStepWorkBill/Sc_MESReturnStepWorkBillListCheckDetai")] [HttpGet] - public ApiResult<DataSet> Sc_MESBeginStepWorkBillListCheckDetai(string HID) + public ApiResult<DataSet> Sc_MESReturnStepWorkBillListCheckDetai(string HID) { if (string.IsNullOrEmpty(HID)) return new ApiResult<DataSet> { code = -1, msg = "ID涓嶈兘涓虹┖" }; SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); - var dataSet = oCN.RunProcReturn("select top 1 * from h_v_Sc_MESBeginWorkBillList_NEW where hmainid= " + HID + " ", "h_v_Sc_MESBeginWorkBillList_NEW"); + var dataSet = oCN.RunProcReturn("select top 1 * from h_v_Sc_MESReturnWorkBillList where hmainid= " + HID + " ", "h_v_Sc_MESReturnWorkBillList"); if (dataSet == null || dataSet.Tables[0].Rows.Count == 0) - return new ApiResult<DataSet> { code = -1, msg = "涓嶅瓨鍦ㄥ紑宸ュ崟鍙�" }; + return new ApiResult<DataSet> { code = -1, msg = "涓嶅瓨鍦ㄨ繑宸ュ崟鍙�" }; return new ApiResult<DataSet> { code = 1, msg = "鏌ヨ鎴愬姛", data = dataSet }; } @@ -99,7 +101,7 @@ { DBUtility.ClsPub.CurUserName = UserName; //缂栬緫鏉冮檺 - if (!DBUtility.ClsPub.Security_Log_second("MES_MESReturnWorkBill_Delete", 1, true, DBUtility.ClsPub.CurUserName)) + if (!DBUtility.ClsPub.Security_Log_second("Sc_ProcessPlan_Drop", 1, true, DBUtility.ClsPub.CurUserName)) { objJsonResult.code = "0"; objJsonResult.count = 0; @@ -181,7 +183,7 @@ [HttpGet] public object AuditReturnStepProcessReportList(int HInterID, int IsAudit, string CurUserName) { - string ModRightNameCheck = "MES_MESReturnWorkBill_Check"; + string ModRightNameCheck = "Sc_ProcessPlan_Check"; DBUtility.ClsPub.CurUserName = CurUserName; try { @@ -308,6 +310,182 @@ } #endregion + #region 杩斿伐鍗曚繚瀛�/缂栬緫 + /// <summary> + /// 杩斿伐鍗� + /// </summary> + /// <param name="msg"></param> + /// <returns></returns> + [Route("Sc_MESReturnStepWorkBill/SaveGetMESReturnStepWorkFrom")] + [HttpPost] + public object SaveGetMESReturnStepWorkFrom([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("Sc_ProcessPlan_Edit", 1, true, DBUtility.ClsPub.CurUserName)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鏃犱繚瀛樻潈闄愶紒"; + objJsonResult.data = null; + return objJsonResult; + } + //鍒ゆ柇浼氳鏈熸槸鍚﹀悎鐞� + string s = ""; + int sYear = 0; + int sPeriod = 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_MESReturnStepWorkBill oBill = new DLL.ClsSc_MESReturnStepWorkBill(); + List<Model.ClsSc_ProcessPlanMain> lsmain = new List<Model.ClsSc_ProcessPlanMain>(); + msg2 = msg2.Replace("\\", ""); + msg2 = msg2.Replace("\n", ""); //\n + lsmain = oListModels.getObjectByJson_Gy_MESReturnWorkFrom(msg2); + foreach (Model.ClsSc_ProcessPlanMain 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; + } + } + if (refSav == "Update") + { + if (BillOld.ShowBill(oItem.HInterID, ref s) == false) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "姝ゅ崟鎹湁璇紒"; + objJsonResult.data = 1; + return objJsonResult; + } + //鍒ゆ柇鏄惁鍙紪杈� + if (BillOld.omodel.HChecker != "" && BillOld.omodel.HChecker != null) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "姝ゅ崟鎹凡缁忚瀹℃牳锛屼笉鍏佽淇敼锛�"; + objJsonResult.data = 1; + return objJsonResult; + } + if (BillOld.omodel.HBillStatus > 1) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "姝ゅ崟鎹浜庝笉鍙紪杈戠姸鎬侊紝涓嶅厑璁镐慨鏀癸紒"; + objJsonResult.data = 1; + return objJsonResult; + } + if (!DBUtility.Xt_BaseBillFun.Fun_AllowEditBill(BillOld, ref s)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = s + "锛屼笉鍏佽淇敼"; + objJsonResult.data = 1; + return objJsonResult; + } + } + + DBUtility.ClsPub.CurUserName = oItem.HMaker; + oItem.HBillType = "3718"; + oItem.HBillSubType = "3718"; + 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")); + 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; //杩斿洖涓籌D + //绯荤粺鍙傛暟 鑷姩瀹℃牳 + 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 = "淇濆瓨澶辫触锛�" + DBUtility.ClsPub.sExeReturnInfo; + objJsonResult.data = 1; + return objJsonResult; + } + } + catch (Exception e) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = e.Message; + objJsonResult.data = 1; + return objJsonResult; + } + } + #endregion #endregion } } -- Gitblit v1.9.1