| | |
| | | using Newtonsoft.Json; |
| | | using Model; |
| | | using DBUtility; |
| | | using SyntacticSugar.constant; |
| | | |
| | | namespace WebAPI.Controllers.MJGL |
| | | { |
| | |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #region 上模单 列表分页查询 |
| | | [Route("Sc_MouldUpperBill/Sc_MouldUpperBillListPage")] |
| | | [HttpGet] |
| | | public object Sc_MouldUpperBillListPage(string sWhere, string user, int page, int size) |
| | | { |
| | | try |
| | | { |
| | | List<object> columnNameList = new List<object>(); |
| | | |
| | | //查看权限 |
| | | if (!DBUtility.ClsPub.Security_Log("Sc_MouldUpperBill_Query", 1, false, user)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "无查看权限!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | sWhere = sWhere.Replace("'", "''"); |
| | | ds = oCN.RunProcReturn("exec h_p_Sc_MouldUpperBillList " + page + "," + size + ",'" + sWhere + "'", "h_p_Sc_MouldUpperBillList"); |
| | | |
| | | //添加列名 |
| | | foreach (DataColumn col in ds.Tables[0].Columns) |
| | | { |
| | | Type dataType = col.DataType; |
| | | string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}"; |
| | | columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//获取到DataColumn列对象的列名 |
| | | } |
| | | |
| | | |
| | | objJsonResult.code = CodeConstant.SUCCEED; |
| | | objJsonResult.count = int.Parse(ds.Tables[1].Rows[0]["count"].ToString()); |
| | | objJsonResult.Message = "Sucess!"; |
| | | objJsonResult.data = ds.Tables[0]; |
| | | objJsonResult.list = columnNameList; |
| | | return objJsonResult; |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | objJsonResult.code = CodeConstant.FAIL; |
| | | objJsonResult.count = CountConstant.FAIL; |
| | | objJsonResult.Message = "没有返回任何记录!" + ex.ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #region 上模单 保存前、保存后控制 |
| | | |
| | | //保存前控制 |
| | | public json BeforeSave_MouldUpperBill(Int64 HInterID, string HBillNo, Int64 OperationType) |
| | | { |
| | | DataSet BeforeSave = oCN.RunProcReturn("Exec h_p_Sc_MouldUpperBill_BeforeSaveCtrl " + HInterID.ToString() + ",'" + HBillNo + "'," + OperationType.ToString(), "h_p_Sc_MouldUpperBill_BeforeSaveCtrl"); |
| | | if (BeforeSave == null || BeforeSave.Tables[0].Rows.Count == 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "保存前判断失败!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | else if (DBUtility.ClsPub.isLong(BeforeSave.Tables[0].Rows[0]["HBack"]) == 1) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; //失败! |
| | | objJsonResult.Message = DBUtility.ClsPub.isStrNull(BeforeSave.Tables[0].Rows[0]["HRemark"]); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | else |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; //成功! |
| | | objJsonResult.Message = DBUtility.ClsPub.isStrNull(BeforeSave.Tables[0].Rows[0]["HRemark"]); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | |
| | | //保存后控制 |
| | | public json AfterSave_MouldUpperBill(Int64 HInterID, string HBillNo, Int64 OperationType) |
| | | { |
| | | DataSet AfterSave = oCN.RunProcReturn("Exec h_p_Sc_MouldUpperBill_AfterSaveCtrl " + HInterID.ToString() + ",'" + HBillNo + "'," + OperationType.ToString(), "h_p_Sc_MouldUpperBill_AfterSaveCtrl"); |
| | | if (AfterSave == null || AfterSave.Tables[0].Rows.Count == 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "保存后判断失败!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | else if (DBUtility.ClsPub.isLong(AfterSave.Tables[0].Rows[0]["HBack"]) == 1) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; //失败! |
| | | objJsonResult.Message = DBUtility.ClsPub.isStrNull(AfterSave.Tables[0].Rows[0]["HRemark"]); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | else |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; //成功! |
| | | objJsonResult.Message = DBUtility.ClsPub.isStrNull(AfterSave.Tables[0].Rows[0]["HRemark"]); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 上模单 新增 |
| | |
| | | |
| | | if ((OperationType == 1) && ds.Tables[0].Rows.Count == 0)//新增 |
| | | { |
| | | //保存前控制 |
| | | objJsonResult = BeforeSave_MouldUpperBill(HInterID, HBillNo, 1); |
| | | if (objJsonResult.count == 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = objJsonResult.Message; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | //主表 |
| | | oCN.RunProc(@"Insert Into Sc_MouldUpperBillMain |
| | | (HBillType,HBillStatus, HBillSubType, HInterID, HBillNo, HDate |
| | |
| | | |
| | | } |
| | | else if (OperationType == 3 || ds.Tables[0].Rows.Count != 0) |
| | | { //修改 |
| | | { |
| | | //保存前控制 |
| | | objJsonResult = BeforeSave_MouldUpperBill(HInterID, HBillNo, 2); |
| | | if (objJsonResult.count == 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = objJsonResult.Message; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | //修改 |
| | | oCN.RunProc("update Sc_MouldUpperBillMain set " + |
| | | "HDate='" + HDate + |
| | | "',HYear='" + HYear + "',HPeriod='" + HPeriod + "',HRemark='" + HRemark + "',hupdater='" + HMaker + |
| | |
| | | oCN.RunProc("delete from Sc_MouldUpperBillSub where HInterID='" + HInterID + "'"); |
| | | } |
| | | //保存子表 |
| | | objJsonResult = AddBillSub(msg3, HInterID, HBillNo); |
| | | objJsonResult = AddBillSub(msg3, HInterID, HBillNo, OperationType); |
| | | if (objJsonResult.code == "0") |
| | | { |
| | | objJsonResult.code = "0"; |
| | |
| | | } |
| | | } |
| | | |
| | | public json AddBillSub(string msg3, long HInterID,string HBillNo) |
| | | public json AddBillSub(string msg3, long HInterID,string HBillNo, Int64 OperationType) |
| | | { |
| | | List<ClsSc_MouldUpperBillSub> DetailColl = Newtonsoft.Json.JsonConvert.DeserializeObject<List<ClsSc_MouldUpperBillSub>>(msg3); |
| | | int i = 0; |
| | |
| | | + HInterID + ",'"+ HBillNo + "'," + i + "," + oSub.HMouldID.ToString() + ",'" + oSub.HQty |
| | | + "'," + oSub.HSourceID.ToString() + "," + oSub.HICMOInterID.ToString() + "," + oSub.HICMOEntryID.ToString()+",'"+ oSub.HICMOBillNo.ToString() + |
| | | "') "); |
| | | |
| | | //反写模具状态 |
| | | oCN.RunProc("update Gy_MouldFileMain set HMouldStatus='领出' where HInterID= " + oSub.HMouldID.ToString()); |
| | | } |
| | | |
| | | if (OperationType == 1)//新增 |
| | | { |
| | | //保存后控制 |
| | | objJsonResult = AfterSave_MouldUpperBill(HInterID, HBillNo, 1); |
| | | if (objJsonResult.count == 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = objJsonResult.Message; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | //保存后控制 |
| | | objJsonResult = AfterSave_MouldUpperBill(HInterID, HBillNo, 2); |
| | | if (objJsonResult.count == 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; |
| | |
| | | } |
| | | #endregion |
| | | |
| | | #region 下模单 列表分页查询 |
| | | [Route("Sc_MouldUpperBill/Sc_MouldLowerBillListPage")] |
| | | [HttpGet] |
| | | public object Sc_MouldLowerBillListPage(string sWhere, string user, int page, int size) |
| | | { |
| | | try |
| | | { |
| | | List<object> columnNameList = new List<object>(); |
| | | |
| | | //查看权限 |
| | | if (!DBUtility.ClsPub.Security_Log("Sc_MouldLowerBill_Query", 1, false, user)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "无查看权限!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | sWhere = sWhere.Replace("'", "''"); |
| | | ds = oCN.RunProcReturn("exec h_p_Sc_MouldLowerBillList " + page + "," + size + ",'" + sWhere + "'", "h_p_Sc_MouldLowerBillList"); |
| | | |
| | | //添加列名 |
| | | foreach (DataColumn col in ds.Tables[0].Columns) |
| | | { |
| | | Type dataType = col.DataType; |
| | | string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}"; |
| | | columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//获取到DataColumn列对象的列名 |
| | | } |
| | | |
| | | |
| | | objJsonResult.code = CodeConstant.SUCCEED; |
| | | objJsonResult.count = int.Parse(ds.Tables[1].Rows[0]["count"].ToString()); |
| | | objJsonResult.Message = "Sucess!"; |
| | | objJsonResult.data = ds.Tables[0]; |
| | | objJsonResult.list = columnNameList; |
| | | return objJsonResult; |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | objJsonResult.code = CodeConstant.FAIL; |
| | | objJsonResult.count = CountConstant.FAIL; |
| | | objJsonResult.Message = "没有返回任何记录!" + ex.ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #region 下模单 保存前、保存后控制 |
| | | |
| | | //保存前控制 |
| | | public json BeforeSave_MouldLowerBill(Int64 HInterID, string HBillNo, Int64 OperationType) |
| | | { |
| | | DataSet BeforeSave = oCN.RunProcReturn("Exec h_p_Sc_MouldLowerBill_BeforeSaveCtrl " + HInterID.ToString() + ",'" + HBillNo + "'," + OperationType.ToString(), "h_p_Sc_MouldLowerBill_BeforeSaveCtrl"); |
| | | if (BeforeSave == null || BeforeSave.Tables[0].Rows.Count == 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "保存前判断失败!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | else if (DBUtility.ClsPub.isLong(BeforeSave.Tables[0].Rows[0]["HBack"]) == 1) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; //失败! |
| | | objJsonResult.Message = DBUtility.ClsPub.isStrNull(BeforeSave.Tables[0].Rows[0]["HRemark"]); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | else |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; //成功! |
| | | objJsonResult.Message = DBUtility.ClsPub.isStrNull(BeforeSave.Tables[0].Rows[0]["HRemark"]); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | |
| | | //保存后控制 |
| | | public json AfterSave_MouldLowerBill(Int64 HInterID, string HBillNo, Int64 OperationType) |
| | | { |
| | | DataSet AfterSave = oCN.RunProcReturn("Exec h_p_Sc_MouldLowerBill_AfterSaveCtrl " + HInterID.ToString() + ",'" + HBillNo + "'," + OperationType.ToString(), "h_p_Sc_MouldLowerBill_AfterSaveCtrl"); |
| | | if (AfterSave == null || AfterSave.Tables[0].Rows.Count == 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "保存后判断失败!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | else if (DBUtility.ClsPub.isLong(AfterSave.Tables[0].Rows[0]["HBack"]) == 1) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; //失败! |
| | | objJsonResult.Message = DBUtility.ClsPub.isStrNull(AfterSave.Tables[0].Rows[0]["HRemark"]); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | else |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; //成功! |
| | | objJsonResult.Message = DBUtility.ClsPub.isStrNull(AfterSave.Tables[0].Rows[0]["HRemark"]); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 下模单 新增 |
| | | /// <summary> |
| | | /// 新增单据-保存按钮 |
| | |
| | | |
| | | if ((OperationType == 1) && ds.Tables[0].Rows.Count == 0)//新增 |
| | | { |
| | | //保存前控制 |
| | | objJsonResult = BeforeSave_MouldLowerBill(HInterID, HBillNo, 1); |
| | | if (objJsonResult.count == 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = objJsonResult.Message; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | //主表 |
| | | oCN.RunProc(@"Insert Into Sc_MouldLowerBillMain |
| | | (HBillType,HBillStatus, HBillSubType, HInterID, HBillNo, HDate |
| | |
| | | |
| | | } |
| | | else if (OperationType == 3 || ds.Tables[0].Rows.Count != 0) |
| | | { //修改 |
| | | { |
| | | //保存前控制 |
| | | objJsonResult = BeforeSave_MouldLowerBill(HInterID, HBillNo, 2); |
| | | if (objJsonResult.count == 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = objJsonResult.Message; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | //修改 |
| | | oCN.RunProc("update Sc_MouldLowerBillMain set " + |
| | | "HDate='" + HDate + |
| | | "',HYear='" + HYear + "',HPeriod='" + HPeriod + "',HRemark='" + HRemark + "',hupdater='" + HMaker + |
| | |
| | | oCN.RunProc("delete from Sc_MouldLowerBillSub where HInterID='" + HInterID + "'"); |
| | | } |
| | | //保存子表 |
| | | objJsonResult = AddMouldLowerBill(msg3, HInterID, HBillNo); |
| | | objJsonResult = AddMouldLowerBill(msg3, HInterID, HBillNo, OperationType); |
| | | if (objJsonResult.code == "0") |
| | | { |
| | | objJsonResult.code = "0"; |
| | |
| | | } |
| | | } |
| | | |
| | | public json AddMouldLowerBill(string msg3, long HInterID, string HBillNo) |
| | | public json AddMouldLowerBill(string msg3, long HInterID, string HBillNo, Int64 OperationType) |
| | | { |
| | | List<ClsSc_MouldLowerBillSub> DetailColl = Newtonsoft.Json.JsonConvert.DeserializeObject<List<ClsSc_MouldLowerBillSub>>(msg3); |
| | | int i = 0; |
| | |
| | | + HInterID + ",'" + HBillNo + "'," + i + "," + oSub.HMouldID.ToString() + ",'" + oSub.HQty |
| | | + "'," + oSub.HSourceID.ToString() + "," + oSub.HICMOInterID.ToString() + "," + oSub.HICMOEntryID.ToString() + ",'" + oSub.HICMOBillNo.ToString() + |
| | | "') "); |
| | | |
| | | //反写模具状态 |
| | | oCN.RunProc("update Gy_MouldFileMain set HMouldStatus='在库' where HInterID= " + oSub.HMouldID.ToString()); |
| | | } |
| | | |
| | | if (OperationType == 1)//新增 |
| | | { |
| | | //保存后控制 |
| | | objJsonResult = AfterSave_MouldLowerBill(HInterID, HBillNo, 1); |
| | | if (objJsonResult.count == 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = objJsonResult.Message; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | //保存后控制 |
| | | objJsonResult = AfterSave_MouldLowerBill(HInterID, HBillNo, 2); |
| | | if (objJsonResult.count == 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; |
| | |
| | | #region 上/下模单获取条码信息 |
| | | [Route("Sc_MouldUpperBill/txtHBarCode_KeyDown")] |
| | | [HttpGet] |
| | | public object txtHBarCode_KeyDown(string HBarCode, string UserID, string HBillType) |
| | | public object txtHBarCode_KeyDown(string HBarCode,int HSourceID, string UserID, string HBillType) |
| | | { |
| | | try |
| | | { |
| | |
| | | return objJsonResult; |
| | | } |
| | | |
| | | ds = oCN.RunProcReturn("exec h_p_Sc_AllowLoadData '" + HBarCode + "'", "h_p_Sc_AllowLoadData"); |
| | | ds = oCN.RunProcReturn("exec h_p_Sc_AllowLoadData '" + HBarCode + "','"+ HSourceID + "','"+ HBillType + "'", "h_p_Sc_AllowLoadData"); |
| | | |
| | | if (ds == null || ds .Tables.Count== 0 || ds.Tables[0].Rows.Count == 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "查无数据!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "保存失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | |
| | | |
| | | if ((OperationType == 1) && ds.Tables[0].Rows.Count == 0)//新增 |
| | | { |
| | | //保存前控制 |
| | | objJsonResult = BeforeSave_MouldUpperBill(HInterID, HBillNo, 1); |
| | | if (objJsonResult.count == 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = objJsonResult.Message; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | //主表 |
| | | oCN.RunProc(@"Insert Into Sc_MouldUpperBillMain |
| | | (HBillType,HBillStatus, HBillSubType, HInterID, HBillNo, HDate |
| | |
| | | |
| | | } |
| | | else if (OperationType == 3 || ds.Tables[0].Rows.Count != 0) |
| | | { //修改 |
| | | { |
| | | //保存前控制 |
| | | objJsonResult = BeforeSave_MouldUpperBill(HInterID, HBillNo, 2); |
| | | if (objJsonResult.count == 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = objJsonResult.Message; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | //修改 |
| | | oCN.RunProc("update Sc_MouldUpperBillMain set " + |
| | | "HDate='" + HDate + |
| | | "',HYear='" + HYear + "',HPeriod='" + HPeriod + "',HRemark='" + HRemark + "',hupdater='" + HMaker + |
| | |
| | | oCN.RunProc("delete from Sc_MouldUpperBillSub where HInterID='" + HInterID + "'"); |
| | | } |
| | | //保存子表 |
| | | objJsonResult = AddBillSub_PDA(msg2, HInterID, HBillNo); |
| | | objJsonResult = AddBillSub_PDA(msg2, HInterID, HBillNo, OperationType); |
| | | if (objJsonResult.code == "0") |
| | | { |
| | | objJsonResult.code = "0"; |
| | |
| | | } |
| | | } |
| | | |
| | | public json AddBillSub_PDA(string msg2, long HInterID, string HBillNo) |
| | | public json AddBillSub_PDA(string msg2, long HInterID, string HBillNo, Int64 OperationType) |
| | | { |
| | | List<ClsSc_MouldUpperBillSub> DetailColl = Newtonsoft.Json.JsonConvert.DeserializeObject<List<ClsSc_MouldUpperBillSub>>(msg2); |
| | | int i = 0; |
| | |
| | | + "'," + oSub.HSourceID.ToString() + "," + oSub.HICMOInterID.ToString() + "," + oSub.HICMOEntryID.ToString() + ",'" + oSub.HICMOBillNo.ToString() |
| | | + "','" + oSub.HProcExchBillNo.ToString() + "'," + oSub.HProcExchInterID.ToString() + "," + oSub.HProcExchEntryID.ToString() |
| | | + ",'" + oSub.HScanDate.ToString() + "','" + oSub.HMouldNumber.ToString() + "') "); |
| | | |
| | | //反写模具状态 |
| | | oCN.RunProc("update Gy_MouldFileMain set HMouldStatus='领出' where HInterID= "+ oSub.HMouldID.ToString()); |
| | | } |
| | | |
| | | if (OperationType == 1)//新增 |
| | | { |
| | | //保存后控制 |
| | | objJsonResult = AfterSave_MouldUpperBill(HInterID, HBillNo, 1); |
| | | if (objJsonResult.count == 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = objJsonResult.Message; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | //保存后控制 |
| | | objJsonResult = AfterSave_MouldUpperBill(HInterID, HBillNo, 2); |
| | | if (objJsonResult.count == 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; |
| | |
| | | |
| | | if ((OperationType == 1) && ds.Tables[0].Rows.Count == 0)//新增 |
| | | { |
| | | //保存前控制 |
| | | objJsonResult = BeforeSave_MouldLowerBill(HInterID, HBillNo, 1); |
| | | if (objJsonResult.count == 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = objJsonResult.Message; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | //主表 |
| | | oCN.RunProc(@"Insert Into Sc_MouldLowerBillMain |
| | | (HBillType,HBillStatus, HBillSubType, HInterID, HBillNo, HDate |
| | |
| | | |
| | | } |
| | | else if (OperationType == 3 || ds.Tables[0].Rows.Count != 0) |
| | | { //修改 |
| | | { |
| | | //保存前控制 |
| | | objJsonResult = BeforeSave_MouldLowerBill(HInterID, HBillNo, 2); |
| | | if (objJsonResult.count == 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = objJsonResult.Message; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | //修改 |
| | | oCN.RunProc("update Sc_MouldLowerBillMain set " + |
| | | "HDate='" + HDate + |
| | | "',HYear='" + HYear + "',HPeriod='" + HPeriod + "',HRemark='" + HRemark + "',hupdater='" + HMaker + |
| | |
| | | oCN.RunProc("delete from Sc_MouldLowerBillSub where HInterID='" + HInterID + "'"); |
| | | } |
| | | //保存子表 |
| | | objJsonResult = AddSc_MouldLowerBillSub_PDA(msg2, HInterID, HBillNo); |
| | | objJsonResult = AddSc_MouldLowerBillSub_PDA(msg2, HInterID, HBillNo, OperationType); |
| | | if (objJsonResult.code == "0") |
| | | { |
| | | objJsonResult.code = "0"; |
| | |
| | | } |
| | | } |
| | | |
| | | public json AddSc_MouldLowerBillSub_PDA(string msg2, long HInterID, string HBillNo) |
| | | public json AddSc_MouldLowerBillSub_PDA(string msg2, long HInterID, string HBillNo, Int64 OperationType) |
| | | { |
| | | List<ClsSc_MouldLowerBillSub> DetailColl = Newtonsoft.Json.JsonConvert.DeserializeObject<List<ClsSc_MouldLowerBillSub>>(msg2); |
| | | int i = 0; |
| | |
| | | + "'," + oSub.HSourceID.ToString() + "," + oSub.HICMOInterID.ToString() + "," + oSub.HICMOEntryID.ToString() + ",'" + oSub.HICMOBillNo.ToString() |
| | | + "','" + oSub.HProcExchBillNo.ToString() + "'," + oSub.HProcExchInterID.ToString() + "," + oSub.HProcExchEntryID.ToString() |
| | | + ",'" + oSub.HScanDate.ToString() + "','" + oSub.HMouldNumber.ToString() + "') "); |
| | | |
| | | //反写模具状态 |
| | | oCN.RunProc("update Gy_MouldFileMain set HMouldStatus='在库' where HInterID= " + oSub.HMouldID.ToString()); |
| | | } |
| | | |
| | | if (OperationType == 1)//新增 |
| | | { |
| | | //保存后控制 |
| | | objJsonResult = AfterSave_MouldLowerBill(HInterID, HBillNo, 1); |
| | | if (objJsonResult.count == 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = objJsonResult.Message; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | //保存后控制 |
| | | objJsonResult = AfterSave_MouldLowerBill(HInterID, HBillNo, 2); |
| | | if (objJsonResult.count == 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; |