| | |
| | | |
| | | private json objJsonResult = new json(); |
| | | |
| | | |
| | | SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); |
| | | DataSet ds; |
| | | |
| | | ///<summary> |
| | | ///封装状态码及返回信息的公用方法。 |
| | | ///参数:DataSet。 |
| | |
| | | return GetObjectJson(ds); |
| | | } |
| | | |
| | | #region 工序计划单 |
| | | List<ClsSc_ProcessPlanSub> DetailColl = new List<ClsSc_ProcessPlanSub>(); |
| | | ClsSc_ProcessPlanMain omodel = new ClsSc_ProcessPlanMain(); |
| | | /// <summary> |
| | | /// 返回生产工序计划单列表 |
| | | ///参数:string sql。 |
| | |
| | | return GetObjectJson(ds); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 返回生产工序派工单列表 |
| | | /// </summary> |
| | | /// <param name="sWhere"></param> |
| | | /// <returns></returns> |
| | | //工序计划单 保存/编辑 |
| | | [Route("Sc_ProcessMangement/AddBill")] |
| | | [HttpPost] |
| | | public object AddBill([FromBody] JObject sMainSub) |
| | | { |
| | | var _value = sMainSub["sMainSub"].ToString(); |
| | | string msg1 = _value.ToString(); |
| | | oCN.BeginTran(); |
| | | //保存主表 |
| | | objJsonResult = AddBillMain(msg1); |
| | | if (objJsonResult.code == "0") |
| | | { |
| | | oCN.RollBack(); |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = objJsonResult.Message; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | oCN.Commit(); |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "新增单据成功!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | public json AddBillMain(string msg1) |
| | | { |
| | | string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries); |
| | | string msg2 = sArray[0].ToString(); |
| | | string msg3 = sArray[1].ToString(); |
| | | |
| | | int hentryid = int.Parse(sArray[2].ToString());//子表的顺序id |
| | | int OperationType = int.Parse(sArray[3].ToString());//数据类型 1添加 3修改 |
| | | try |
| | | { |
| | | omodel = Newtonsoft.Json.JsonConvert.DeserializeObject<ClsSc_ProcessPlanMain>(msg2); |
| | | string BillType = "3715"; |
| | | |
| | | |
| | | if (OperationType == 1)//新增 |
| | | { |
| | | //主表 |
| | | oCN.RunProc("Insert Into Sc_ProcessPlanMain " + |
| | | "(HYear,HPeriod,HBillType,HBillSubType,HInterID" + |
| | | ",HDate,HBillNo,HBillStatus,HCheckItemNowID,HCheckItemNextID" + |
| | | ",HICMOInterID,HICMOBillNo,HMaterID,HMaterNumber,HUnitID" + |
| | | ",HUnitNumber,HPlanQty,HPlanBeginDate,HPlanEndDate,HExplanation" + |
| | | ",HRemark,HInnerBillNo,HMaker,HMakeDate" + |
| | | ") " + |
| | | " values(" + omodel.HYear.ToString() + "," + omodel.HPeriod.ToString() + ",'" + BillType + "','" + BillType + "'," + omodel.HInterID.ToString() + |
| | | ",'" + omodel.HDate.ToShortDateString() + "','" + omodel.HBillNo + "'," + omodel.HBillStatus.ToString() + "," + omodel.HCheckItemNowID.ToString() + "," + omodel.HCheckItemNextID.ToString() + |
| | | "," + omodel.HICMOInterID.ToString() + ",'" + omodel.HICMOBillNo + "'," + omodel.HMaterID.ToString() + ",'" + omodel.HMaterNumber + "'," + omodel.HUnitID.ToString() + |
| | | ",'" + omodel.HUnitNumber + "'," + omodel.HPlanQty.ToString() + ",'" + omodel.HPlanBeginDate.ToShortDateString() + "','" + omodel.HPlanEndDate.ToShortDateString() + "','" + omodel.HExplanation + "'" + |
| | | ",'" + omodel.HRemark + "','" + omodel.HInnerBillNo + "','" + DBUtility.ClsPub.CurUserName + "',getdate()" + |
| | | ") "); |
| | | } |
| | | else if (OperationType == 3) |
| | | { |
| | | //修改 |
| | | |
| | | |
| | | //删除子表 |
| | | |
| | | } |
| | | //保存子表 |
| | | objJsonResult = AddBillSub(msg3, hentryid); |
| | | if (objJsonResult.code == "0") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = objJsonResult.Message; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = null; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "Exception!" + e.ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | |
| | | public json AddBillSub(string msg3, int hentryid) |
| | | { |
| | | DetailColl = Newtonsoft.Json.JsonConvert.DeserializeObject<List<ClsSc_ProcessPlanSub>>(msg3); |
| | | int i = 1; |
| | | //插入子表 |
| | | foreach (Models.ClsSc_ProcessPlanSub oSub in DetailColl) |
| | | { |
| | | oCN.RunProc("Insert into Sc_ProcessPlanSub " + |
| | | " (HInterID,HEntryID,HBillNo,HProcNo,HProcID,HWorkingQty" + |
| | | ",HProcNumber,HWorkRemark,HCenterID,HDeptID,HDeptNumber" + |
| | | ",HGroupID,HGroupNumber,HWorkerID,HWorkerNumber,HSourceID" + |
| | | ",HQty,HTimeUnit,HPlanWorkTimes,HPlanBeginDate,HPlanEndDate" + |
| | | ",HICMOInterID,HICMOBillNo,HSeOrderInterID,HSeOrderEntryID,HSeOrderBillNo" + |
| | | ",HCloseMan,HCloseType,HRemark,HSourceInterID,HSourceEntryID" + |
| | | ",HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" + |
| | | ",HBeginDayQty,HBeginFixQty,HFixWorkDays,HTrunWorkDays,HReadyTimes" + |
| | | ",HReadyTime,HQueueTime,HMoveTime,HBatchNo" + |
| | | ") values(" |
| | | + omodel.HInterID.ToString() + "," +(hentryid==-1?i: hentryid) + ",'" + oSub.HBillNo + "'," + oSub.HProcNo.ToString() + "," + oSub.HProcID.ToString() + "," + oSub.HWorkingQty.ToString() + |
| | | ",'" + oSub.HProcNumber + "','" + oSub.HWorkRemark + "'," + oSub.HCenterID.ToString() + "," + oSub.HDeptID.ToString() + ",'" + oSub.HDeptNumber + "'" + |
| | | "," + oSub.HGroupID.ToString() + ",'" + oSub.HGroupNumber + "'," + oSub.HWorkerID.ToString() + ",'" + oSub.HWorkerNumber + "'," + oSub.HSourceID.ToString() + |
| | | "," + oSub.HQty.ToString() + ",'" + oSub.HTimeUnit + "'," + oSub.HPlanWorkTimes.ToString() + ",'" + oSub.HPlanBeginDate.ToShortDateString() + "','" + oSub.HPlanEndDate.ToShortDateString() + "'" + |
| | | "," + oSub.HICMOInterID.ToString() + ",'" + oSub.HICMOBillNo + "'," + oSub.HSeOrderInterID.ToString() + "," + oSub.HSeOrderEntryID.ToString() + ",'" + oSub.HSeOrderBillNo + "'" + |
| | | ",'" + oSub.HCloseMan + "'," + Convert.ToString(oSub.HCloseType ? 1 : 0) + ",'" + oSub.HRemark + "'," + oSub.HSourceInterID.ToString() + "," + oSub.HSourceEntryID.ToString() + |
| | | ",'" + oSub.HSourceBillNo + "','" + oSub.HSourceBillType + "'," + oSub.HRelationQty.ToString() + "," + oSub.HRelationMoney.ToString() + |
| | | "," + oSub.HBeginDayQty.ToString() + "," + oSub.HBeginFixQty.ToString() + "," + oSub.HFixWorkDays.ToString() + "," + oSub.HTrunWorkDays.ToString() + "," + oSub.HReadyTimes.ToString() + |
| | | "," + oSub.HReadyTime.ToString() + "," + oSub.HQueueTime.ToString() + "," + oSub.HMoveTime.ToString() + ",'" + oSub.HBatchNo + "'" + |
| | | ") "); |
| | | i++; |
| | | } |
| | | |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = null; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | #endregion |
| | | /// <summary> |
| | | /// 返回生产工序派工单列表 |
| | | /// </summary> |
| | | /// <param name="sWhere"></param> |
| | | /// <returns></returns> |
| | | [Route("Sc_ProcessMangement/MES_Sc_ProcessSendWorkMain_Json")] |
| | | [HttpGet] |
| | | public object MES_Sc_ProcessSendWorkMain_Json(string sWhere) |