| | |
| | | #region 报工平台报检申请保存 |
| | | [Route("Sc_MESBeginWorkBill/SaveGetMESProductReportBillList")] |
| | | [HttpGet] |
| | | public object SaveGetMESProductReportBillList([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(); |
| | | |
| | | |
| | | public object SaveGetMESProductReportBillList(string ScMaxWork,string HSourceBillType, string workcode,int HSourceID,int HICMOInterID,int HICMOEntryID,string HMaker) |
| | | { |
| | | ListModels oListModels = new ListModels(); |
| | | try |
| | | { |
| | | DLL.ClsSc_ICMOReportBill oBill = new DLL.ClsSc_ICMOReportBill(); |
| | | List<Models.ClsSc_ICMOReportBillMain> lsmain = new List<Models.ClsSc_ICMOReportBillMain>(); |
| | | msg2 = msg2.Replace("\\", ""); |
| | | msg2 = msg2.Replace("\n", ""); //\n |
| | | lsmain = oListModels.getObjectByJson_Gy_ICMOReportBillMain(msg2); |
| | | |
| | | string sHSourceType = HSourceBillType; |
| | | string BillType = "3711"; //单据类型 (生产汇报单) |
| | | //得到mainid |
| | | long HInterID = DBUtility.ClsPub.CreateBillID(BillType, ref DBUtility.ClsPub.sExeReturnInfo); |
| | | oCN.BeginTran(); |
| | | //根据单号、资源ID、订单主ID、订单子ID、制单人过滤产量汇报报检申请提交数据 |
| | | string sql = string.Format(@"update Sc_ICMOBillWorkQtyStatus_Tmp set |
| | | HICMOReportInterID ='"+HInterID+"', HICMOReportBillNo='"+ ScMaxWork + "' from Sc_ICMOBillWorkQtyStatus_Tmp a where a.HICMOBillNo='" + workcode+ "' and a.HSourceID='" + HSourceID + "' and HICMOInterID='" + HICMOInterID+ "' and a.HICMOEntryID='"+ HICMOEntryID + "' and a.HMaker='"+HMaker+"' and HRelationInterID='0'"); |
| | | oCN.RunProc(sql); |
| | | oCN.Commit(); |
| | | //根据生产订单号查询生产订单表,拿到组织、车间 |
| | | DataSet ds0 = oCN.RunProcReturn("select HPRDORGID,HDeptID from Sc_ICMOBillMain where HBillNo='"+ workcode + "'", "Sc_ICMOBillMain"); |
| | | |
| | | //查询产量汇报临时表 |
| | | ds = oCN.RunProcReturn("select top1* from Sc_ICMOBillWorkQtyStatus_Tmp where HICMOReportInterID='"+ HInterID + "' and HICMOReportBillNo='" + ScMaxWork + "'", "Sc_ICMOBillWorkQtyStatus_Tmp"); |
| | | if (ds.Tables[0].Rows.Count <= 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "当前单据无产量汇报记录!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | //调用WebService服务 |
| | | WebS.ClsSc_ICMOReportBillMain model = new WebS.ClsSc_ICMOReportBillMain(); |
| | | model.HInterID = HInterID; |
| | | model.HBillNo = ScMaxWork; |
| | | model.HYear= DBUtility.ClsPub.isLong(DateTime.Now.Year); |
| | | model.HPeriod = DBUtility.ClsPub.isLong(DateTime.Now.Month); |
| | | model.HRemark = ""; |
| | | model.HMaker = HMaker; |
| | | model.HEmpID = 0; |
| | | 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(ds.Tables[0].Rows[0]["HPRDORGID"]); |
| | | WebS.WebService1 oWebs = new WebS.WebService1(); |
| | | bool flag=oWebs.set_SaveICMOProductReportBill_Layui(model, sHSourceType, ref DBUtility.ClsPub.sErrInfo); |
| | | if (flag) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "保存成功!"; |
| | | objJsonResult.data = 1; |
| | | } |
| | | else |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "保存失败!" + DBUtility.ClsPub.sErrInfo; |
| | | objJsonResult.data = null; |
| | | } |
| | | } |
| | | catch (Exception e) |
| | | { |