| | |
| | | List<WebAPI.Models.Sc_ProcessPlanViewModel> ls = new List<WebAPI.Models.Sc_ProcessPlanViewModel>(); |
| | | ls = oListModels.getObjectByJson_SendWorkSub(msg3); |
| | | int i = 0; |
| | | Model.ClsSc_ProcessSendWorkSub sendworksub = new Model.ClsSc_ProcessSendWorkSub(); |
| | | List<Model.ClsSc_ProcessSendWorkSub> lss = new List<Model.ClsSc_ProcessSendWorkSub>(); |
| | | foreach (WebAPI.Models.Sc_ProcessPlanViewModel oItemSub in ls) |
| | | { |
| | | |
| | | //foreach (var item in collection) |
| | | //{ |
| | | |
| | | //} |
| | | //i++; |
| | | //if (oItemSub.HQty <= 0) |
| | | //{ |
| | | // objJsonResult.code = "0"; |
| | | // objJsonResult.count = 0; |
| | | // objJsonResult.Message = "保存失败!第" + i.ToString() + "行数量不大于0无法保存!"; |
| | | // objJsonResult.data = 1; |
| | | // return objJsonResult; |
| | | //} |
| | | //if (oItemSub.HQty > oItemSub.HRelationQty) |
| | | //{ |
| | | // objJsonResult.code = "0"; |
| | | // objJsonResult.count = 0; |
| | | // objJsonResult.Message = "保存失败!第" + i.ToString() + "行数量不能大于未关联数量!"; |
| | | // objJsonResult.data = 1; |
| | | // return objJsonResult; |
| | | //} |
| | | i++; |
| | | Model.ClsSc_ProcessSendWorkSub sendworksub = new Model.ClsSc_ProcessSendWorkSub(); |
| | | sendworksub.HProcID = oItemSub.hprocid.Value;//--工序ID |
| | | sendworksub.HProcPlanBillNo = oItemSub.工序计划单号; //--工序计划单号 |
| | | sendworksub.HProcPlanEntryID = oItemSub.hsubid.Value; //--工序计划单子ID |
| | | sendworksub.HProcPlanInterID = oItemSub.hmainid.Value; //--工序计划单ID |
| | | sendworksub.HICMOInterID = oItemSub.hicmointerid.Value; //--任务单ID |
| | | sendworksub.HICMOBillNo = oItemSub.任务单号; //--任务单号 |
| | | sendworksub.HSeOrderBillNo = oItemSub.销售订单号; //--销售订单号 |
| | | sendworksub.HSeOrderEntryID = oItemSub.销售订单子ID.Value; //--销售子ID |
| | | sendworksub.HSeOrderInterID = oItemSub.销售订单主ID.Value; //--销售订单主ID |
| | | sendworksub.HPlanTimes = (float)oItemSub.计划加工时间; //--计划工时 |
| | | sendworksub.HPlanEndDate = oItemSub.计划完工日期.Value; //--计划完工日期 |
| | | sendworksub.HPlanBeginDate = oItemSub.计划开工日期.Value; //--计划开工日期 |
| | | sendworksub.HQty = (double)oItemSub.计划数量; //--派工数量 |
| | | sendworksub.HWorkerNumber = oItemSub.操作员代码; //--操作工代码 |
| | | sendworksub.HWorkerID = oItemSub.HWorkerID.Value; //--操作工ID |
| | | sendworksub.HGroupNumber = oItemSub.班组代码; //班组代码 |
| | | sendworksub.HGroupID = oItemSub.HGroupID.Value; //--班组ID |
| | | sendworksub.HSourceNumber = oItemSub.生产资源; //--生产资源代码 |
| | | //--生产资源ID |
| | | sendworksub.HProcNumber = oItemSub.工序代码; //--工序代码 |
| | | sendworksub.HRemark = oItemSub.表体备注; //--备注 |
| | | |
| | | 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"; |
| | |
| | | // return objJsonResult; |
| | | //} |
| | | |
| | | //oItemSub.HEntryID = i; |
| | | //oItemSub.HEntryCloseDate = DBUtility.ClsPub.isDate(DateTime.Now); |
| | | //oItemSub.HRemark = ""; |
| | | //oItemSub.HCloseMan = ""; |
| | | //oItemSub.HCloseType = false; |
| | | //Sendwork.DetailColl.Add(oItemSub); |
| | | sendworksub.HEntryID = i; |
| | | sendworksub.HEntryCloseDate = DBUtility.ClsPub.isDate(DateTime.Now); |
| | | sendworksub.HRemark = ""; |
| | | sendworksub.HCloseMan = ""; |
| | | sendworksub.HCloseType = false; |
| | | sendworksub.HSourceBillType = oItemSub.HBillType; |
| | | 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; |
| | | } |
| | | //保存 |
| | | //保存完毕后处理 |