| | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 保存委外派工单信息 |
| | | /// </summary> |
| | | /// <param name="msg"></param> |
| | | /// <returns></returns> |
| | | [Route("SaveWWProcessSendWork")] |
| | | [HttpPost] |
| | | public object SaveWWProcessSendWork([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 msg3 = sArray[1].ToString(); |
| | | |
| | | string UserName = ""; |
| | | ListModels oListModels = new ListModels(); |
| | | |
| | | try |
| | | { |
| | | WebAPI.DLL.ClsSc_ProcessSendWork Sendwork = new WebAPI.DLL.ClsSc_ProcessSendWork(); |
| | | List<WebAPI.Models.ClsSc_ProcessSendWorkMain> lsmain = new List<WebAPI.Models.ClsSc_ProcessSendWorkMain>(); |
| | | msg2 = msg2.Replace("\\", ""); |
| | | msg2 = msg2.Replace("\n", ""); |
| | | lsmain = oListModels.getObjectByJson_WWSendWorkMain(msg2); |
| | | foreach (WebAPI.Models.ClsSc_ProcessSendWorkMain oItem in lsmain) |
| | | { |
| | | UserName = oItem.HMaker; |
| | | oItem.HMakeDate = DBUtility.ClsPub.isStrNull(DateTime.Now.ToString("yyyy-MM-dd")); |
| | | oItem.HYear = DBUtility.ClsPub.isLong(DateTime.Now.Year); |
| | | oItem.HDate = DateTime.Now; |
| | | oItem.HMainSourceInterID = oItem.HInterID; |
| | | oItem.HInterID = 0; |
| | | if (DBUtility.ClsPub.isStrNull(oItem.HPlanBeginDate) == "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "保存失败!没有填写计划开工日期,无法保存!"; |
| | | objJsonResult.data = 1; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | Sendwork.omodel = oItem; |
| | | |
| | | |
| | | } |
| | | |
| | | //表体数据 |
| | | //按 },{来拆分数组 //去掉【和】 |
| | | msg3 = msg3.Substring(1, msg3.Length - 2); |
| | | msg3 = msg3.Replace("\\", ""); |
| | | msg3 = msg3.Replace("\n", ""); //\n |
| | | List<WebAPI.Models.WW_EntrustWorkOrderViewModel> ls = new List<WebAPI.Models.WW_EntrustWorkOrderViewModel>(); |
| | | ls = oListModels.getObjectByJson_WWSendWorkSub(msg3); |
| | | int i = 0; |
| | | List<Model.ClsSc_ProcessSendWorkSub> lss = new List<Model.ClsSc_ProcessSendWorkSub>(); |
| | | foreach (WebAPI.Models.WW_EntrustWorkOrderViewModel oItemSub in ls) |
| | | { |
| | | |
| | | i++; |
| | | Model.ClsSc_ProcessSendWorkSub sendworksub = new Model.ClsSc_ProcessSendWorkSub(); |
| | | sendworksub.HProcID = 0;//--工序ID |
| | | sendworksub.HSourceInterID = (long)oItemSub.hmainid;//源单id |
| | | sendworksub.HSourceEntryID = oItemSub.hsubid; //--源单子ID |
| | | sendworksub.HSourceBillNo = oItemSub.单据号; //--源单单号 |
| | | sendworksub.HSourceBillType = oItemSub.HBillType; //--源单类型 |
| | | sendworksub.HQty = oItemSub.数量; //--数量 |
| | | sendworksub.HICMOBillNo = ""; //--任务单号 |
| | | sendworksub.HSeOrderBillNo = ""; //--销售订单号 |
| | | sendworksub.HSeOrderEntryID = 0; //--销售子ID |
| | | sendworksub.HSeOrderInterID = 0; //--销售订单主ID |
| | | sendworksub.HPlanTimes = 0; //--计划工时 |
| | | sendworksub.HPlanEndDate = DateTime.Now; //--计划完工日期 |
| | | sendworksub.HPlanBeginDate = DateTime.Now; //--计划开工日期 |
| | | sendworksub.HQty = (double)oItemSub.数量; //--派工数量 |
| | | sendworksub.HWorkerNumber = ""; //--操作工代码 |
| | | sendworksub.HWorkerID = 0; //--操作工ID |
| | | sendworksub.HGroupNumber = ""; //班组代码 |
| | | sendworksub.HGroupID =0; //--班组ID |
| | | sendworksub.HSourceNumber = ""; //--生产资源代码 |
| | | //--生产资源ID |
| | | sendworksub.HProcNumber = ""; //--工序代码 |
| | | |
| | | if (oItemSub.数量 <= 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "保存失败!第" + i.ToString() + "行数量不大于0无法保存!"; |
| | | objJsonResult.data = 1; |
| | | return objJsonResult; |
| | | } |
| | | if (Convert.ToInt32(sendworksub.HQty) > Convert.ToInt32(oItemSub.数量)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "保存失败!第" + i.ToString() + "行委外派工数量不能大于委外工单数量!"; |
| | | objJsonResult.data = 1; |
| | | return objJsonResult; |
| | | } |
| | | //if (DBUtility.ClsPub.isStrNull(oItemSub.HBatChNo) == "") |
| | | //{ |
| | | // objJsonResult.code = "0"; |
| | | // objJsonResult.count = 0; |
| | | // objJsonResult.Message = "保存失败!第" + i.ToString() + "行未填写批号!"; |
| | | // objJsonResult.data = 1; |
| | | // return objJsonResult; |
| | | //} |
| | | |
| | | sendworksub.HEntryID = i; |
| | | sendworksub.HEntryCloseDate = DBUtility.ClsPub.isDate(DateTime.Now); |
| | | sendworksub.HRemark = ""; |
| | | sendworksub.HCloseMan = ""; |
| | | sendworksub.HCloseType = false; |
| | | lss.Add(sendworksub);//先把数据存放到派工单子表集合里 |
| | | |
| | | |
| | | } |
| | | if (lss.Count > 0) |
| | | { |
| | | //然后再循环保存到派工单子表的集合里 |
| | | foreach (Model.ClsSc_ProcessSendWorkSub Itemsendwork in lss) |
| | | { |
| | | Sendwork.DetailColl.Add(Itemsendwork); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "保存失败!lss集合小于0"; |
| | | objJsonResult.data = 1; |
| | | return objJsonResult; |
| | | } |
| | | //保存 |
| | | //保存完毕后处理 |
| | | bool bResult; |
| | | if (Sendwork.omodel.HInterID == 0) |
| | | { |
| | | // bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); |
| | | bResult = Sendwork.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); |
| | | } |
| | | else |
| | | { |
| | | bResult = Sendwork.ModifyBill(Sendwork.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo); |
| | | } |
| | | if (bResult) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "保存成功!"; |
| | | //WebAPIController.Add_Log("送货单下推", UserName, "生成送货单"); |
| | | 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.ToString(); |
| | | objJsonResult.data = 1; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 返回委外工单列表 |
| | | /// </summary> |
| | | /// <param name="sWhere"></param> |
| | |
| | | SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); |
| | | if (sWhere == null || sWhere.Equals("")) |
| | | { |
| | | ds = oCN.RunProcReturn("select top 500 * from WW_EntrustWorkOrderBillMain ", "WW_EntrustWorkOrderBillMain"); |
| | | ds = oCN.RunProcReturn("select top 500 * from h_v_WW_EntrustWorkOrderBillList ", "h_v_WW_EntrustWorkOrderBillList"); |
| | | } |
| | | else |
| | | { |
| | | string sql1 = "select * from WW_EntrustWorkOrderBillMain where 1 = 1 "; |
| | | string sql1 = "select * from h_v_WW_EntrustWorkOrderBillList where 1 = 1 "; |
| | | string sql = sql1 + sWhere; |
| | | ds = oCN.RunProcReturn(sql, "WW_EntrustWorkOrderBillMain"); |
| | | ds = oCN.RunProcReturn(sql, "h_v_WW_EntrustWorkOrderBillList"); |
| | | } |
| | | } |
| | | catch (Exception e) |
| | |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// 保存委外汇报单信息 |
| | | /// </summary> |
| | | /// <param name="msg"></param> |
| | | /// <returns></returns> |
| | | [Route("SaveWW_EntrustProcessReportBill")] |
| | | [HttpPost] |
| | | public object SaveWW_EntrustProcessReportBill([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 msg3 = sArray[1].ToString(); |
| | | |
| | | string UserName = ""; |
| | | ListModels oListModels = new ListModels(); |
| | | |
| | | try |
| | | { |
| | | WebAPI.DLL.ClsWW_EntrustProcessReportBill Sendwork = new WebAPI.DLL.ClsWW_EntrustProcessReportBill(); |
| | | List<WebAPI.Models.ClsWW_EntrustProcessReportBillMain> lsmain = new List<WebAPI.Models.ClsWW_EntrustProcessReportBillMain>(); |
| | | msg2 = msg2.Replace("\\", ""); |
| | | msg2 = msg2.Replace("\n", ""); |
| | | lsmain = oListModels.getObjectByJson_WW_EntrustProcessReportBillMain(msg2); |
| | | foreach (WebAPI.Models.ClsWW_EntrustProcessReportBillMain oItem in lsmain) |
| | | { |
| | | UserName = oItem.HMaker; |
| | | oItem.HMakeDate = DBUtility.ClsPub.isStrNull(DateTime.Now.ToString("yyyy-MM-dd")); |
| | | oItem.HYear = DBUtility.ClsPub.isLong(DateTime.Now.Year); |
| | | oItem.HDate = DateTime.Now; |
| | | oItem.HMainSourceInterID = oItem.HInterID; |
| | | oItem.HInterID = 0; |
| | | Sendwork.omodel = oItem; |
| | | |
| | | |
| | | } |
| | | |
| | | //表体数据 |
| | | //按 },{来拆分数组 //去掉【和】 |
| | | msg3 = msg3.Substring(1, msg3.Length - 2); |
| | | msg3 = msg3.Replace("\\", ""); |
| | | msg3 = msg3.Replace("\n", ""); //\n |
| | | List<WebAPI.Models.WW_EntrustProcSendWorkViewModel> ls = new List<WebAPI.Models.WW_EntrustProcSendWorkViewModel>(); |
| | | ls = oListModels.getObjectByJson_WW_EntrustProcSendWork(msg3); |
| | | int i = 0; |
| | | List<Models.ClsWW_EntrustProcessReportBillSub> lss = new List<Models.ClsWW_EntrustProcessReportBillSub>(); |
| | | foreach (WebAPI.Models.WW_EntrustProcSendWorkViewModel oItemSub in ls) |
| | | { |
| | | |
| | | i++; |
| | | Models.ClsWW_EntrustProcessReportBillSub sendworksub = new Models.ClsWW_EntrustProcessReportBillSub(); |
| | | sendworksub.HProcID = 0;//--工序ID |
| | | sendworksub.HSourceInterID = (long)oItemSub.hmainid;//源单id |
| | | sendworksub.HSourceEntryID = (long)oItemSub.hsubid; //--源单子ID |
| | | sendworksub.HSourceBillNo = oItemSub.单据号; //--源单单号 |
| | | sendworksub.HSourceBillType = oItemSub.HBillType; //--源单类型 |
| | | sendworksub.HQty = (decimal)oItemSub.数量; //--数量 |
| | | sendworksub.HICMOBillNo = ""; //--任务单号 |
| | | sendworksub.HSeOrderBillNo = ""; //--销售订单号 |
| | | sendworksub.HSeOrderEntryID = 0; //--销售子ID |
| | | sendworksub.HSeOrderInterID = 0; //--销售订单主ID |
| | | sendworksub.HTimes = 0; //--计划工时 |
| | | if (oItemSub.数量 <= 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "保存失败!第" + i.ToString() + "行数量不大于0无法保存!"; |
| | | objJsonResult.data = 1; |
| | | return objJsonResult; |
| | | } |
| | | if (Convert.ToInt32(sendworksub.HQty) > Convert.ToInt32(oItemSub.数量)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "保存失败!第" + i.ToString() + "行委外汇报数量不能大于委外派工单数量!"; |
| | | objJsonResult.data = 1; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | |
| | | sendworksub.HEntryID = i; |
| | | sendworksub.HEntryCloseDate = DBUtility.ClsPub.isDate(DateTime.Now); |
| | | sendworksub.HRemark = ""; |
| | | sendworksub.HCloseMan = ""; |
| | | sendworksub.HCloseType = false; |
| | | lss.Add(sendworksub);//先把数据存放到派工单子表集合里 |
| | | |
| | | |
| | | } |
| | | if (lss.Count > 0) |
| | | { |
| | | //然后再循环保存到派工单子表的集合里 |
| | | foreach (Models.ClsWW_EntrustProcessReportBillSub Itemsendwork in lss) |
| | | { |
| | | Sendwork.DetailColl.Add(Itemsendwork); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "保存失败!lss集合小于0"; |
| | | objJsonResult.data = 1; |
| | | return objJsonResult; |
| | | } |
| | | //保存 |
| | | //保存完毕后处理 |
| | | bool bResult; |
| | | if (Sendwork.omodel.HInterID == 0) |
| | | { |
| | | // bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); |
| | | bResult = Sendwork.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); |
| | | } |
| | | else |
| | | { |
| | | bResult = Sendwork.ModifyBill(Sendwork.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo); |
| | | } |
| | | if (bResult) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "保存成功!"; |
| | | //WebAPIController.Add_Log("送货单下推", UserName, "生成送货单"); |
| | | 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.ToString(); |
| | | objJsonResult.data = 1; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// 委外派工单号获取信息 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | [Route("Sc_ProcessMangement/WWgetHbarCodeDetail")] |
| | | [HttpGet] |
| | | public ApiResult<DataSet> WWGetHbarCodeDetail(string sBillBarCode) |
| | | { |
| | | var model = LuBaoSevice.WWGetHbarCodeDetail(sBillBarCode); |
| | | return model; |
| | | } |
| | | |
| | | /// <summary> |
| | | ///委外工序号获得信息 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | [Route("Sc_ProcessMangement/WWgetProcDetail")] |
| | | [HttpGet] |
| | | public ApiResult<DataSet> WWGetProcDetail(string sBillNo, string sProcNo) |
| | | { |
| | | var model = LuBaoSevice.WWGetProcDetail(sBillNo, sProcNo); |
| | | return model; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// PDA委外工序汇报单保存 |
| | | /// </summary> |
| | | /// <param name="msg"></param> |
| | | /// <returns></returns> |
| | | [Route("SaveWWReport")] |
| | | [HttpPost] |
| | | public object SaveWWReport([FromBody] JObject msg) |
| | | { |
| | | var _value = msg["msg"].ToString(); |
| | | string msg1 = _value.ToString(); |
| | | ListModels oListModels = new ListModels(); |
| | | try |
| | | { |
| | | WebAPI.DLL.ClsWW_EntrustProcessReportBill ReportModel = new WebAPI.DLL.ClsWW_EntrustProcessReportBill(); |
| | | List<WebAPI.Models.WWReportViewModel> ls = new List<WebAPI.Models.WWReportViewModel>(); |
| | | ls = oListModels.getObjectByJson_WWReport(msg1); |
| | | int i = 0; |
| | | |
| | | foreach (Models.WWReportViewModel ItemView in ls) |
| | | { |
| | | i++; |
| | | Models.ClsWW_EntrustProcessReportBillMain ReportMain = new Models.ClsWW_EntrustProcessReportBillMain(); |
| | | Models.ClsWW_EntrustProcessReportBillSub ReportSub = new Models.ClsWW_EntrustProcessReportBillSub(); |
| | | //工序汇报单主表保存 |
| | | ReportMain.HBillType = "3742"; |
| | | ReportMain.HBillNo = ItemView.HBillNo; |
| | | ReportMain.HMakeDate = DBUtility.ClsPub.isStrNull(DateTime.Now.ToString("yyyy-MM-dd")); |
| | | ReportMain.HYear = DBUtility.ClsPub.isLong(DateTime.Now.Year); |
| | | ReportMain.HDate = DateTime.Now; |
| | | ReportMain.HMaker = ""; |
| | | ReportMain.HCloseType = false; |
| | | ReportMain.HPrintQty = 0; |
| | | ReportMain.HMainSourceBillType = "3740"; |
| | | ReportMain.HMainSourceInterID =0; |
| | | ReportMain.HMainSourceBillNo = ItemView.HWW_BillNo; |
| | | ReportMain.HInterID = 0; |
| | | ReportMain.HPeriod = 1; |
| | | ReportMain.HBillSubType = "3742"; |
| | | ReportMain.HBillStatus = 0; |
| | | ReportMain.HCheckItemNowID = 0; |
| | | ReportMain.HCheckItemNextID = 0; |
| | | ReportMain.HDeptID = Convert.ToInt32(ItemView.HDeptID); |
| | | ReportMain.HExplanation = ""; |
| | | ReportMain.HInnerBillNo = ""; |
| | | ReportMain.HSupID =Convert.ToInt32( ItemView.HSupID); |
| | | |
| | | |
| | | //保存到汇报单主表 |
| | | ReportModel.omodel = ReportMain; |
| | | |
| | | |
| | | ReportSub.HMaterID = Convert.ToInt32(ItemView.HMaterID); |
| | | ReportSub.HICMOBillNo = ""; |
| | | ReportSub.HICMOInterID = 0; |
| | | ReportSub.HEntryID = i; |
| | | ReportSub.HEntryCloseDate = DBUtility.ClsPub.isDate(DateTime.Now); |
| | | ReportSub.HRemark = ""; |
| | | ReportSub.HCloseMan = ""; |
| | | ReportSub.HCloseType = false; |
| | | ReportSub.HSourceBillType = "3740"; |
| | | ReportSub.HQty = Convert.ToDecimal(ItemView.HQty); |
| | | ReportSub.HProcID =Convert.ToInt32( ItemView.HProcID); |
| | | ReportSub.HTimes = 0; |
| | | ReportSub.HSeOrderInterID = 0; |
| | | ReportSub.HSeOrderEntryID = 0; |
| | | ReportSub.HSeOrderBillNo = ""; |
| | | ReportSub.HProcPlanInterID = 0; |
| | | ReportSub.HProcPlanBillNo = ""; |
| | | ReportSub.HSourceInterID = 0; |
| | | ReportSub.HSourceBillNo = ""; |
| | | ReportSub.HRelationQty = 0; |
| | | ReportSub.HRelationMoney = 0; |
| | | ReportSub.HCheckQty = 0; |
| | | ReportSub.HBadCount = 0; |
| | | ReportSub.HWasterQty = 0; |
| | | ReportSub.HWasterQty2 = 0; |
| | | ReportSub.HPrice = 0; |
| | | ReportSub.HMoney = 0; |
| | | ReportSub.HProcPlanInterID = 0; |
| | | ReportSub.HProcPlanEntryID = 0; |
| | | ReportSub.HProcPlanBillNo = ""; |
| | | ReportSub.HSourceEntryID = 0; |
| | | ReportSub.HSourceBillType = ""; |
| | | ReportSub.HRelationQty = 0; |
| | | ReportSub.HRelationMoney = 0; |
| | | ReportSub.HBadPrirce = 0; |
| | | ReportSub.HBadMoney = 0; |
| | | ReportSub.HWasterPrice = 0; |
| | | ReportSub.HWasterMoney = 0; |
| | | ReportSub.HQualityRate = 0; |
| | | ReportSub.HUsingQty = 0; |
| | | ReportSub.HSelfBadCount = 0; |
| | | ReportSub.HPreBadCount = 0; |
| | | ReportSub.HPayMentQty = 0; |
| | | ReportSub.HPackType = ""; |
| | | ReportSub.HCheckEmpID = 0; |
| | | ReportSub.HWeight = 0; |
| | | ReportSub.HBatchNo = ""; |
| | | |
| | | //保存到委外汇报单子表 |
| | | ReportModel.DetailColl.Add(ReportSub); |
| | | } |
| | | //保存 |
| | | //保存完毕后处理 |
| | | bool bResult; |
| | | bResult = ReportModel.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); |
| | | if (bResult) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "保存成功!"; |
| | | //WebAPIController.Add_Log("送货单下推", UserName, "生成送货单"); |
| | | 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.ToString(); |
| | | objJsonResult.data = 1; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 保存委外转出单信息 |
| | | /// </summary> |
| | | /// <param name="msg"></param> |
| | | /// <returns></returns> |
| | | [Route("SaveWW_EntrustProcessSendOutBill")] |
| | | [HttpPost] |
| | | public object SaveWW_EntrustProcessSendOutBill([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 msg3 = sArray[1].ToString(); |
| | | |
| | | string UserName = ""; |
| | | ListModels oListModels = new ListModels(); |
| | | |
| | | try |
| | | { |
| | | WebAPI.DLL.ClsWW_EntrustProcessSendOutBill Sendwork = new WebAPI.DLL.ClsWW_EntrustProcessSendOutBill(); |
| | | List<WebAPI.Models.ClsWW_EntrustProcessSendOutBillMain> lsmain = new List<WebAPI.Models.ClsWW_EntrustProcessSendOutBillMain>(); |
| | | msg2 = msg2.Replace("\\", ""); |
| | | msg2 = msg2.Replace("\n", ""); |
| | | lsmain = oListModels.getObjectByJson_WW_EntrustProcessSendOutBillMain(msg2); |
| | | foreach (WebAPI.Models.ClsWW_EntrustProcessSendOutBillMain oItem in lsmain) |
| | | { |
| | | UserName = oItem.HMaker; |
| | | oItem.HMakeDate = DBUtility.ClsPub.isStrNull(DateTime.Now.ToString("yyyy-MM-dd")); |
| | | oItem.HYear = DBUtility.ClsPub.isLong(DateTime.Now.Year); |
| | | oItem.HDate = DateTime.Now; |
| | | oItem.HMainSourceInterID = oItem.HInterID; |
| | | oItem.HInterID = 0; |
| | | Sendwork.omodel = oItem; |
| | | |
| | | |
| | | } |
| | | |
| | | //表体数据 |
| | | //按 },{来拆分数组 //去掉【和】 |
| | | msg3 = msg3.Substring(1, msg3.Length - 2); |
| | | msg3 = msg3.Replace("\\", ""); |
| | | msg3 = msg3.Replace("\n", ""); //\n |
| | | List<WebAPI.Models.WW_EntrustProcSendWorkViewModel> ls = new List<WebAPI.Models.WW_EntrustProcSendWorkViewModel>(); |
| | | ls = oListModels.getObjectByJson_WW_EntrustProcSendWork(msg3); |
| | | int i = 0; |
| | | List<Models.ClsWW_EntrustProcessSendOutBillSub> lss = new List<Models.ClsWW_EntrustProcessSendOutBillSub>(); |
| | | foreach (WebAPI.Models.WW_EntrustProcSendWorkViewModel oItemSub in ls) |
| | | { |
| | | |
| | | i++; |
| | | Models.ClsWW_EntrustProcessSendOutBillSub sendworksub = new Models.ClsWW_EntrustProcessSendOutBillSub(); |
| | | sendworksub.HProcID = 0;//--工序ID |
| | | sendworksub.HSourceInterID = (long)oItemSub.hmainid;//源单id |
| | | sendworksub.HSourceEntryID = (long)oItemSub.hsubid; //--源单子ID |
| | | sendworksub.HSourceBillNo = oItemSub.单据号; //--源单单号 |
| | | sendworksub.HSourceBillType = oItemSub.HBillType; //--源单类型 |
| | | sendworksub.HQty = (decimal)oItemSub.数量; //--数量 |
| | | sendworksub.HICMOBillNo = ""; //--任务单号 |
| | | sendworksub.HSeOrderBillNo = ""; //--销售订单号 |
| | | sendworksub.HSeOrderEntryID = 0; //--销售子ID |
| | | sendworksub.HSeOrderInterID = 0; //--销售订单主ID |
| | | if (oItemSub.数量 <= 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "保存失败!第" + i.ToString() + "行数量不大于0无法保存!"; |
| | | objJsonResult.data = 1; |
| | | return objJsonResult; |
| | | } |
| | | if (Convert.ToInt32(sendworksub.HQty) > Convert.ToInt32(oItemSub.数量)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "保存失败!第" + i.ToString() + "行委外汇报数量不能大于委外派工单数量!"; |
| | | objJsonResult.data = 1; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | |
| | | sendworksub.HEntryID = i; |
| | | sendworksub.HEntryCloseDate = DBUtility.ClsPub.isDate(DateTime.Now); |
| | | sendworksub.HRemark = ""; |
| | | sendworksub.HCloseMan = ""; |
| | | sendworksub.HCloseType = false; |
| | | lss.Add(sendworksub);//先把数据存放到派工单子表集合里 |
| | | |
| | | |
| | | } |
| | | if (lss.Count > 0) |
| | | { |
| | | //然后再循环保存到派工单子表的集合里 |
| | | foreach (Models.ClsWW_EntrustProcessSendOutBillSub Itemsendwork in lss) |
| | | { |
| | | Sendwork.DetailColl.Add(Itemsendwork); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "保存失败!lss集合小于0"; |
| | | objJsonResult.data = 1; |
| | | return objJsonResult; |
| | | } |
| | | //保存 |
| | | //保存完毕后处理 |
| | | bool bResult; |
| | | if (Sendwork.omodel.HInterID == 0) |
| | | { |
| | | // bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); |
| | | bResult = Sendwork.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); |
| | | } |
| | | else |
| | | { |
| | | bResult = Sendwork.ModifyBill(Sendwork.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo); |
| | | } |
| | | if (bResult) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "保存成功!"; |
| | | //WebAPIController.Add_Log("送货单下推", UserName, "生成送货单"); |
| | | 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.ToString(); |
| | | objJsonResult.data = 1; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// PDA委外工序转出单保存 |
| | | /// </summary> |
| | | /// <param name="msg"></param> |
| | | /// <returns></returns> |
| | | [Route("SaveWWSendOutBill")] |
| | | [HttpPost] |
| | | public object SaveWWSendOutBill([FromBody] JObject msg) |
| | | { |
| | | var _value = msg["msg"].ToString(); |
| | | string msg1 = _value.ToString(); |
| | | ListModels oListModels = new ListModels(); |
| | | try |
| | | { |
| | | WebAPI.DLL.ClsWW_EntrustProcessSendOutBill ReportModel = new WebAPI.DLL.ClsWW_EntrustProcessSendOutBill(); |
| | | List<WebAPI.Models.WWSendOutBillViewModel> ls = new List<WebAPI.Models.WWSendOutBillViewModel>(); |
| | | ls = oListModels.getObjectByJson_WWSendOutBill(msg1); |
| | | int i = 0; |
| | | |
| | | foreach (Models.WWSendOutBillViewModel ItemView in ls) |
| | | { |
| | | i++; |
| | | Models.ClsWW_EntrustProcessSendOutBillMain ReportMain = new Models.ClsWW_EntrustProcessSendOutBillMain(); |
| | | Models.ClsWW_EntrustProcessSendOutBillSub ReportSub = new Models.ClsWW_EntrustProcessSendOutBillSub(); |
| | | //工序转出单主表保存 |
| | | ReportMain.HBillType = "3741"; |
| | | ReportMain.HBillNo = ItemView.HBillNo; |
| | | ReportMain.HMakeDate = DBUtility.ClsPub.isStrNull(DateTime.Now.ToString("yyyy-MM-dd")); |
| | | ReportMain.HYear = DBUtility.ClsPub.isLong(DateTime.Now.Year); |
| | | ReportMain.HDate = DateTime.Now; |
| | | ReportMain.HMaker = ""; |
| | | ReportMain.HCloseType = false; |
| | | ReportMain.HPrintQty = 0; |
| | | ReportMain.HMainSourceBillType = "3740"; |
| | | ReportMain.HMainSourceInterID = 0; |
| | | ReportMain.HMainSourceBillNo = ItemView.HWW_BillNo; |
| | | ReportMain.HInterID = 0; |
| | | ReportMain.HPeriod = 1; |
| | | ReportMain.HBillSubType = "3741"; |
| | | ReportMain.HBillStatus = 0; |
| | | ReportMain.HCheckItemNowID = 0; |
| | | ReportMain.HCheckItemNextID = 0; |
| | | ReportMain.HDeptID = Convert.ToInt32(ItemView.HDeptID); |
| | | ReportMain.HExplanation = ""; |
| | | ReportMain.HInnerBillNo = ""; |
| | | ReportMain.HSupID = Convert.ToInt32(ItemView.HSupID); |
| | | |
| | | |
| | | //保存到转出单主表 |
| | | ReportModel.omodel = ReportMain; |
| | | |
| | | |
| | | ReportSub.HMaterID = Convert.ToInt32(ItemView.HMaterID); |
| | | ReportSub.HICMOBillNo = ""; |
| | | ReportSub.HICMOInterID = 0; |
| | | ReportSub.HEntryID = i; |
| | | ReportSub.HEntryCloseDate = DBUtility.ClsPub.isDate(DateTime.Now); |
| | | ReportSub.HRemark = ""; |
| | | ReportSub.HCloseMan = ""; |
| | | ReportSub.HCloseType = false; |
| | | ReportSub.HSourceBillType = "3740"; |
| | | ReportSub.HQty = Convert.ToDecimal(ItemView.HQty); |
| | | ReportSub.HProcID = Convert.ToInt32(ItemView.HProcID); |
| | | ReportSub.HSeOrderInterID = 0; |
| | | ReportSub.HSeOrderEntryID = 0; |
| | | ReportSub.HSeOrderBillNo = ""; |
| | | ReportSub.HProcPlanInterID = 0; |
| | | ReportSub.HProcPlanBillNo = ""; |
| | | ReportSub.HSourceInterID = 0; |
| | | ReportSub.HSourceBillNo = ""; |
| | | ReportSub.HRelationQty = 0; |
| | | ReportSub.HRelationMoney = 0; |
| | | ReportSub.HPrice = 0; |
| | | ReportSub.HMoney = 0; |
| | | ReportSub.HProcPlanInterID = 0; |
| | | ReportSub.HProcPlanEntryID = 0; |
| | | ReportSub.HProcPlanBillNo = ""; |
| | | ReportSub.HSourceEntryID = 0; |
| | | ReportSub.HSourceBillType = ""; |
| | | ReportSub.HRelationQty = 0; |
| | | ReportSub.HRelationMoney = 0; |
| | | ReportSub.HPackType = ""; |
| | | ReportSub.HBatchNo = ""; |
| | | |
| | | //保存到委外转出单子表 |
| | | ReportModel.DetailColl.Add(ReportSub); |
| | | } |
| | | //保存 |
| | | //保存完毕后处理 |
| | | bool bResult; |
| | | bResult = ReportModel.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); |
| | | if (bResult) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "保存成功!"; |
| | | //WebAPIController.Add_Log("送货单下推", UserName, "生成送货单"); |
| | | 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.ToString(); |
| | | objJsonResult.data = 1; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// 保存委外工单信息 |
| | | /// </summary> |
| | | /// <param name="msg"></param> |
| | | /// <returns></returns> |
| | | [Route("SaveWWWorkOrder")] |
| | | [HttpPost] |
| | | public object SaveWWWorkOrder([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 msg3 = sArray[1].ToString(); |
| | | |
| | | string UserName = ""; |
| | | ListModels oListModels = new ListModels(); |
| | | |
| | | try |
| | | { |
| | | WebAPI.DLL.ClsWW_EntrustWorkOrderBill WorkOrder = new WebAPI.DLL.ClsWW_EntrustWorkOrderBill(); |
| | | List<Models.ClsWW_EntrustWorkOrderBillMain> lsmain = new List<Models.ClsWW_EntrustWorkOrderBillMain>(); |
| | | msg2 = msg2.Replace("\\", ""); |
| | | msg2 = msg2.Replace("\n", ""); |
| | | lsmain = oListModels.getObjectByJson_WorkOrderMain(msg2); |
| | | foreach (Models.ClsWW_EntrustWorkOrderBillMain oItem in lsmain) |
| | | { |
| | | UserName = oItem.HMaker; |
| | | oItem.HMakeDate = DBUtility.ClsPub.isStrNull(DateTime.Now.ToString("yyyy-MM-dd")); |
| | | oItem.HYear = DBUtility.ClsPub.isLong(DateTime.Now.Year); |
| | | oItem.HDate = DateTime.Now; |
| | | oItem.HMainSourceInterID = oItem.HInterID; |
| | | oItem.HInterID = 0; |
| | | |
| | | |
| | | |
| | | WorkOrder.omodel = oItem; |
| | | |
| | | |
| | | } |
| | | |
| | | //表体数据 |
| | | //按 },{来拆分数组 //去掉【和】 |
| | | msg3 = msg3.Substring(1, msg3.Length - 2); |
| | | msg3 = msg3.Replace("\\", ""); |
| | | msg3 = msg3.Replace("\n", ""); //\n |
| | | List<WebAPI.Models.Sc_ProcessPlanViewModel> ls = new List<WebAPI.Models.Sc_ProcessPlanViewModel>(); |
| | | ls = oListModels.getObjectByJson_SendWorkSub(msg3); |
| | | int i = 0; |
| | | List<Models.ClsWW_EntrustWorkOrderBillSub> lss = new List<Models.ClsWW_EntrustWorkOrderBillSub>(); |
| | | foreach (WebAPI.Models.Sc_ProcessPlanViewModel oItemSub in ls) |
| | | { |
| | | |
| | | i++; |
| | | Models.ClsWW_EntrustWorkOrderBillSub WorkOrdersub = new Models.ClsWW_EntrustWorkOrderBillSub(); |
| | | WorkOrdersub.HProcID = oItemSub.hprocid.Value;//--工序ID |
| | | WorkOrdersub.HSourceInterID = oItemSub.hmainid.Value; //--源单id |
| | | WorkOrdersub.HSourceEntryID = oItemSub.hsubid.Value; //--源单子ID |
| | | WorkOrdersub.HSourceBillNo = oItemSub.单据号; //--源单单号 |
| | | WorkOrdersub.HSourceBillType= oItemSub.HBillType; //--源单类型 |
| | | WorkOrdersub.HRelationQty = 0; //--关联数量 |
| | | WorkOrdersub.HRelationMoney = 0; //--关联金额 |
| | | WorkOrdersub.HOrderBillNo = ""; //--销售订单号 |
| | | WorkOrdersub.HMaterLenModel = ""; //--材质 |
| | | WorkOrdersub.HMaterQty = 0; //--材质数量 |
| | | WorkOrdersub.HMaterID = oItemSub.HMaterID.Value; //--物料 |
| | | WorkOrdersub.HQty = (double)oItemSub.计划数量; //--订单数量 |
| | | WorkOrdersub.HEntrustType = "3739"; //--委外类型 |
| | | WorkOrdersub.HNextProcName = ""; //--下道工序 |
| | | WorkOrdersub.HPrice =0; //加工费 |
| | | WorkOrdersub.HOutQty = 0; //--关联发出数量 |
| | | WorkOrdersub.HInQty =0; //--关联接收数量 |
| | | WorkOrdersub.HBackSupDate = DateTime.Now; //--实际交货日期 |
| | | WorkOrdersub.HInDate = DateTime.Now; //--交货日期 |
| | | WorkOrdersub.HWorkProcFlow = ""; //--工艺流 |
| | | WorkOrdersub.HLeftMater = ""; //--余料情况 |
| | | |
| | | if (oItemSub.计划数量 <= 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "保存失败!第" + i.ToString() + "行数量不大于0无法保存!"; |
| | | objJsonResult.data = 1; |
| | | return objJsonResult; |
| | | } |
| | | if (Convert.ToInt32(WorkOrdersub.HQty) > Convert.ToInt32(oItemSub.计划数量)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "保存失败!第" + i.ToString() + "行派工数量不能大于计划单数量!"; |
| | | objJsonResult.data = 1; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | WorkOrdersub.HEntryID = i; |
| | | WorkOrdersub.HEntryCloseDate = DBUtility.ClsPub.isDate(DateTime.Now); |
| | | WorkOrdersub.HRemark = ""; |
| | | WorkOrdersub.HCloseMan = ""; |
| | | WorkOrdersub.HCloseType = false; |
| | | WorkOrdersub.HSourceBillType = oItemSub.HBillType; |
| | | lss.Add(WorkOrdersub);//先把数据存放到委外工单子表集合里 |
| | | |
| | | |
| | | } |
| | | if (lss.Count > 0) |
| | | { |
| | | //然后再循环保存到委外工单子表的集合里 |
| | | foreach (Models.ClsWW_EntrustWorkOrderBillSub Itemsendwork in lss) |
| | | { |
| | | WorkOrder.DetailColl.Add(Itemsendwork); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "保存失败!lss集合小于0"; |
| | | objJsonResult.data = 1; |
| | | return objJsonResult; |
| | | } |
| | | //保存 |
| | | //保存完毕后处理 |
| | | bool bResult; |
| | | if (WorkOrder.omodel.HInterID == 0) |
| | | { |
| | | // bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); |
| | | bResult = WorkOrder.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); |
| | | } |
| | | else |
| | | { |
| | | bResult = WorkOrder.ModifyBill(WorkOrder.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo); |
| | | } |
| | | if (bResult) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "保存成功!"; |
| | | //WebAPIController.Add_Log("送货单下推", UserName, "生成送货单"); |
| | | 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.ToString(); |
| | | objJsonResult.data = 1; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | } |
| | | } |