| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Data; |
| | | using System.IO; |
| | | using System.Web; |
| | | using System.Web.Http; |
| | | using ViewAPI; |
| | | using WebAPI.Models; |
| | |
| | | public SQLHelper.ClsCN oCn = new SQLHelper.ClsCN(); |
| | | public DAL.ClsSc_ICMOBill BillOld = new DAL.ClsSc_ICMOBill(); |
| | | SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); |
| | | Pub_Class.ClsXt_SystemParameter oSystemParameter = new Pub_Class.ClsXt_SystemParameter(); |
| | | |
| | | public DAL.ClsSc_MouldScrapInBill BillNew0 = new DAL.ClsSc_MouldScrapInBill(); //模具报废入库对应单据类 |
| | | public DAL.ClsSc_MouldScrapInBill BillOld0 = new DAL.ClsSc_MouldScrapInBill(); //模具报废入库对应单据类 |
| | | string fileip = System.Configuration.ConfigurationManager.AppSettings["FileIP"]; |
| | | |
| | | |
| | | /// <summary> |
| | |
| | | { |
| | | try |
| | | { |
| | | List<object> columnNameList = new List<object>(); |
| | | if (!DBUtility.ClsPub.Security_Log("Sc_MouldMaintainPlanBillList", 1, false, user)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | |
| | | |
| | | ds = Sc_MouldMaintainPlanBillList_s(sWhere); |
| | | |
| | | //添加列名 |
| | | 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列对象的列名 |
| | | } |
| | | |
| | | //if (ds.Tables[0].Rows.Count != 0 || ds != null) |
| | | //{ |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "Sucess!"; |
| | | objJsonResult.data = ds.Tables[0]; |
| | | objJsonResult.list = columnNameList; |
| | | return objJsonResult; |
| | | //} |
| | | //else |
| | |
| | | |
| | | oItemSub.HCloseType = false; //关闭类型 |
| | | |
| | | oItemSub.HSourceInterID = 0; // 源单主内码 |
| | | oItemSub.HSourceEntryID = 0; //源单子内码 |
| | | //oItemSub.HSourceInterID = 0; // 源单主内码 |
| | | //oItemSub.HSourceEntryID = 0; //源单子内码 |
| | | |
| | | |
| | | oBill.DetailColl.Add(oItemSub); |
| | | |
| | | } |
| | | |
| | | //进行 会计期间 结账 的判断和控制 |
| | | int sYear = 0; |
| | | int sPeriod = 0; |
| | | DateTime HDate = DateTime.Now; |
| | | if (DBUtility.Xt_BaseBillFun.Fun_AllowYearPeriod(HDate, ref sYear, ref sPeriod, ref s) == false) |
| | | { |
| | | objJsonResult.Message = s; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | //保存 |
| | | //保存完毕后处理 |
| | | bool bResult; |
| | |
| | | return objJsonResult; |
| | | } |
| | | |
| | | //进行 会计期间 结账 的判断和控制 |
| | | string s = ""; |
| | | int sYear = 0; |
| | | int sPeriod = 0; |
| | | DateTime HDate = DateTime.Now; |
| | | if (DBUtility.Xt_BaseBillFun.Fun_AllowYearPeriod(HDate, ref sYear, ref sPeriod, ref s) == false) |
| | | { |
| | | objJsonResult.Message = s; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | ClsPub.CurUserName = user; |
| | | BillOld.MvarItemKey = "Kf_ICStockBillMain"; |
| | | oCN.BeginTran();//开始事务 |
| | | |
| | | |
| | | |
| | | //Type 1 审核 2 反审核 |
| | | if (Type == 1) |
| | |
| | | return objJsonResult; |
| | | } |
| | | //=========================================================== |
| | | |
| | | |
| | | //反审核单据 |
| | | if (oBill.AbandonCheck(oBill.omodel.HInterID, oBill.omodel.HBillNo, "h_p_Kf_MoveStockBill_AfterUnCheckCtrl", user, ref DBUtility.ClsPub.sExeReturnInfo) == true) |
| | |
| | | } |
| | | #endregion |
| | | |
| | | |
| | | #region 调拨单列表 |
| | | #region 直接调拨单列表 |
| | | /// <summary> |
| | | /// 调拨单列表 |
| | | /// </summary> |
| | |
| | | { |
| | | try |
| | | { |
| | | List<object> columnNameList = new List<object>(); //定义声明变量 ,把通过 new List<object>()创建的 实例,赋值给变量 |
| | | //判断是否有查询权限 |
| | | if (!DBUtility.ClsPub.Security_Log("Kf_MoveStockBillQuery", 1, false, user)) |
| | | { |
| | |
| | | string sql = "select * from h_v_IF_MoveStockBillList where 1=1 " + sWhere+ "order by hmainid desc"; |
| | | ds = oCN.RunProcReturn(sql, "h_v_IF_MoveStockBillList"); |
| | | } |
| | | foreach (DataColumn col in ds.Tables[0].Columns)//遍历ds中第一个表(Tables[0])的所有列(Columns)每次循环中,col变量会持有当前列的引用 |
| | | { |
| | | Type dataType = col.DataType; //获取当前数据类型传入 自定义变量datadataType |
| | | string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}"; //字符串拼接 // 将列名和数据类型信息拼接成一个JSON格式的字符串 |
| | | columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//获取到DataColumn列对象的列名 |
| | | } |
| | | |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "Sucess!"; |
| | | objJsonResult.data = ds.Tables[0]; |
| | | objJsonResult.list = columnNameList; |
| | | return objJsonResult; |
| | | |
| | | } |
| | |
| | | } |
| | | #endregion |
| | | |
| | | #region 调拨单 删除 |
| | | #region 直接调拨单 删除 |
| | | [Route("Kf_MoveStockBill/DelteteGetMoveStockBill")] |
| | | [HttpGet] |
| | | public object DelteteGetMoveStockBill(string HInterID, string user) |
| | |
| | | } |
| | | //================================================================================== |
| | | |
| | | //进行 会计期间 结账 的判断和控制 |
| | | int sYear = 0; |
| | | int sPeriod = 0; |
| | | DateTime HDate = DateTime.Now; |
| | | if (DBUtility.Xt_BaseBillFun.Fun_AllowYearPeriod(HDate, ref sYear, ref sPeriod, ref s) == false) |
| | | { |
| | | objJsonResult.Message = s; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | oCN.BeginTran(); |
| | | |
| | | //直接调拨单 删除 撤销 回填 调拨申请单 关联数量 |
| | | oCN.RunProc("exec h_p_Kf_UpDateRelation_MoveStockRequestToPOStockIn_Del " + HInterID); |
| | | |
| | | oCN.RunProc("Delete From Kf_ICStockBillMain where HInterID = " + HInterID); |
| | | oCN.RunProc("Delete From Kf_ICStockBillSub where HInterID = " + HInterID); |
| | | |
| | |
| | | } |
| | | #endregion |
| | | |
| | | #region 直接调拨单 根据主内码与子内码获取调拨申请单数据 |
| | | [Route("Kf_MoveStockBill/loadKf_MoveStockBillMain_Push")] |
| | | [HttpGet] |
| | | public object loadKf_MoveStockBillMain_Push(long HInterID, long HSubID) |
| | | { |
| | | try |
| | | { |
| | | |
| | | ds = oCN.RunProcReturn("select * from h_v_IF_MoveStockRequestBillList_Litee where hmainid =" + HInterID + " and hsubid = " + HSubID, "h_v_IF_MoveStockRequestBillList_Litee"); |
| | | if (ds == null || ds.Tables[0].Rows.Count == 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "未查询到源单信息!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | else |
| | | { |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "Sucess!"; |
| | | objJsonResult.data = ds.Tables[0]; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "Exception!" + e.ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #endregion |
| | | |
| | | |
| | |
| | | { |
| | | try |
| | | { |
| | | List<object> columnNameList = new List<object>(); //定义声明变量 ,把通过 new List<object>()创建的 实例,赋值给变量 |
| | | //判断是否有查询权限 |
| | | if (!DBUtility.ClsPub.Security_Log("Kf_SellOutBillQuery", 1, false, user)) |
| | | { |
| | |
| | | } |
| | | |
| | | ds = Sc_GetSellOutBillList(sWhere); |
| | | foreach (DataColumn col in ds.Tables[0].Columns)//遍历ds中第一个表(Tables[0])的所有列(Columns)每次循环中,col变量会持有当前列的引用 |
| | | { |
| | | Type dataType = col.DataType; //获取当前数据类型传入 自定义变量datadataType |
| | | string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}"; //字符串拼接 // 将列名和数据类型信息拼接成一个JSON格式的字符串 |
| | | columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//获取到DataColumn列对象的列名 |
| | | } |
| | | |
| | | //if (ds.Tables[0].Rows.Count != 0 || ds != null) |
| | | //{ |
| | |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "Sucess!"; |
| | | objJsonResult.data = ds.Tables[0]; |
| | | objJsonResult.list = columnNameList; |
| | | return objJsonResult; |
| | | //} |
| | | //else |
| | |
| | | if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "删除失败!原因:删除前判断失败,请与网络管理人员联系"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | |
| | | if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "删除失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | //================================================================================== |
| | | |
| | | //进行 会计期间 结账 的判断和控制 |
| | | int sYear = 0; |
| | | int sPeriod = 0; |
| | | DateTime HDate = DateTime.Now; |
| | | if (DBUtility.Xt_BaseBillFun.Fun_AllowYearPeriod(HDate, ref sYear, ref sPeriod, ref s) == false) |
| | | { |
| | | objJsonResult.Message = s; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | oCN.BeginTran(); |
| | | //销售出库删除回填销售订单关联数量 |
| | | //oCN.RunProc("exec h_p_Xs_UpDateRelation_SeOrderToSellOut_Delete " + HInterID); |
| | | oCN.RunProc("exec h_p_Xs_UpDateRelation_SeOrderToSellOut_Delete " + HInterID); |
| | | |
| | | //oCN.RunProc("Delete From Kf_ICStockBillMain where HInterID = " + HInterID); |
| | | //oCN.RunProc("Delete From Kf_ICStockBillSub where HInterID = " + HInterID); |
| | | //销售出库删除回填收货通知单关联数量 |
| | | oCN.RunProc("exec h_p_Xs_UpDateRelation_SeOutStockToPOStockIn_Delete " + HInterID); |
| | | |
| | | string sql = "exec h_p_WMS_ICStockBillAndWMS_Delete " + BillOld.omodel.HInterID + ",'" + BillOld.omodel.HBillNo + "','1205'"; |
| | | oCn.RunProc(sql); |
| | | |
| | | oCN.RunProc("Delete From Kf_ICStockBillMain where HInterID = " + HInterID); |
| | | oCN.RunProc("Delete From Kf_ICStockBillSub where HInterID = " + HInterID); |
| | | |
| | | //string sql = "exec h_p_WMS_ICStockBillAndWMS_Delete " + BillOld.omodel.HInterID + ",'" + BillOld.omodel.HBillNo + "','1205'"; |
| | | //oCn.RunProc(sql); |
| | | |
| | | //删除后控制================================================================================== |
| | | string sql2 = "exec h_p_Kf_SellOutBill_AfterDelCtrl " + BillOld.omodel.HInterID + ",'" + BillOld.omodel.HBillNo + "','" + user + "'"; |
| | |
| | | { |
| | | s = "删除后判断失败,请与网络管理人员联系"; |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "删除失败!原因:" + s; |
| | | objJsonResult.data = null; |
| | | oCN.RollBack(); |
| | |
| | | { |
| | | s = ds.Tables[0].Rows[0]["HRemark"].ToString(); |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "删除失败!原因:" + s; |
| | | objJsonResult.data = null; |
| | | oCN.RollBack(); |
| | |
| | | oBill.DetailColl.Add(oItemSub); |
| | | |
| | | } |
| | | |
| | | //进行 会计期间 结账 的判断和控制 |
| | | int sYear = 0; |
| | | int sPeriod = 0; |
| | | DateTime HDate = DateTime.Now; |
| | | if (DBUtility.Xt_BaseBillFun.Fun_AllowYearPeriod(HDate, ref sYear, ref sPeriod, ref s) == false) |
| | | { |
| | | objJsonResult.Message = s; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | //保存 |
| | | //保存完毕后处理 |
| | | bool bResult; |
| | |
| | | { |
| | | try |
| | | { |
| | | List<object> columnNameList = new List<object>(); //定义声明变量 ,把通过 new List<object>()创建的 实例,赋值给变量 |
| | | //判断是否有查询权限 |
| | | if (!DBUtility.ClsPub.Security_Log("Kf_OtherOutBillQuery", 1, false, user)) |
| | | { |
| | |
| | | string sql = "select * from h_v_Kf_OtherOutBillList where 1 = 1 " + sWhere+ " order by hmainid desc"; |
| | | ds = oCN.RunProcReturn(sql, "h_v_Kf_OtherOutBillList"); |
| | | } |
| | | |
| | | foreach (DataColumn col in ds.Tables[0].Columns)//遍历ds中第一个表(Tables[0])的所有列(Columns)每次循环中,col变量会持有当前列的引用 |
| | | { |
| | | Type dataType = col.DataType; //获取当前数据类型传入 自定义变量datadataType |
| | | string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}"; //字符串拼接 // 将列名和数据类型信息拼接成一个JSON格式的字符串 |
| | | columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//获取到DataColumn列对象的列名 |
| | | } |
| | | //if (ds.Tables[0].Rows.Count != 0 || ds != null) |
| | | |
| | | |
| | | //{ |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "Sucess!"; |
| | | objJsonResult.data = ds.Tables[0]; |
| | | objJsonResult.data = ds.Tables[0];//代码将第一个DataTable(索引为0)赋值给objJsonResult的data属性 |
| | | objJsonResult.list = columnNameList;//将columnNameList赋值给objJsonResult的list属性 |
| | | return objJsonResult; |
| | | //} |
| | | //else |
| | |
| | | return objJsonResult; |
| | | } |
| | | //================================================================================== |
| | | |
| | | //进行 会计期间 结账 的判断和控制 |
| | | int sYear = 0; |
| | | int sPeriod = 0; |
| | | DateTime HDate = DateTime.Now; |
| | | if (DBUtility.Xt_BaseBillFun.Fun_AllowYearPeriod(HDate, ref sYear, ref sPeriod, ref s) == false) |
| | | { |
| | | objJsonResult.Message = s; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | |
| | | oCN.BeginTran(); |
| | | oCN.RunProc("Delete From Kf_ICStockBillMain where HInterID = " + HInterID); |
| | |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据不存在!原因:" + DBUtility.ClsPub.sExeReturnInfo; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | //进行 会计期间 结账 的判断和控制 |
| | | string s = ""; |
| | | int sYear = 0; |
| | | int sPeriod = 0; |
| | | DateTime HDate = DateTime.Now; |
| | | if (DBUtility.Xt_BaseBillFun.Fun_AllowYearPeriod(HDate, ref sYear, ref sPeriod, ref s) == false) |
| | | { |
| | | objJsonResult.Message = s; |
| | | return objJsonResult; |
| | | } |
| | | |
| | |
| | | oBill.DetailColl.Add(oItemSub); |
| | | |
| | | } |
| | | |
| | | //进行 会计期间 结账 的判断和控制 |
| | | int sYear = 0; |
| | | int sPeriod = 0; |
| | | DateTime HDate = DateTime.Now; |
| | | if (DBUtility.Xt_BaseBillFun.Fun_AllowYearPeriod(HDate, ref sYear, ref sPeriod, ref s) == false) |
| | | { |
| | | objJsonResult.Message = s; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | //保存 |
| | | //保存完毕后处理 |
| | | bool bResult; |
| | |
| | | return objJsonResult; |
| | | } |
| | | |
| | | //进行 会计期间 结账 的判断和控制 |
| | | string s = ""; |
| | | int sYear = 0; |
| | | int sPeriod = 0; |
| | | DateTime HDate = DateTime.Now; |
| | | if (DBUtility.Xt_BaseBillFun.Fun_AllowYearPeriod(HDate, ref sYear, ref sPeriod, ref s) == false) |
| | | { |
| | | objJsonResult.Message = s; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | ClsPub.CurUserName = user; |
| | | BillOld.MvarItemKey = "Kf_ICStockBillMain"; |
| | |
| | | } |
| | | //================================================================================== |
| | | |
| | | |
| | | //审核单据 |
| | | if (!oBill.CheckBill(oBill.omodel.HInterID, oBill.omodel.HBillNo, "h_p_Kf_ICStockBill_AfterCheckCtrl", user, ref DBUtility.ClsPub.sExeReturnInfo) == true) |
| | | { |
| | |
| | | return objJsonResult; |
| | | } |
| | | //=========================================================== |
| | | |
| | | |
| | | //反审核单据 |
| | | if (oBill.AbandonCheck(oBill.omodel.HInterID, oBill.omodel.HBillNo, "h_p_Kf_ICStockBill_AfterUnCheckCtrl", user, ref DBUtility.ClsPub.sExeReturnInfo) == true) |
| | |
| | | { |
| | | try |
| | | { |
| | | List<object> columnNameList = new List<object>(); //定义声明变量 ,把通过 new List<object>()创建的 实例,赋值给变量 |
| | | //判断是否有查询权限 |
| | | if (!DBUtility.ClsPub.Security_Log("Kf_OtherInBillQuery", 1, false, user)) |
| | | { |
| | |
| | | string sql = "select * from h_v_Kf_OtherInBillList where 1 = 1 " + sWhere+ " order by hmainid desc"; |
| | | ds = oCN.RunProcReturn(sql, "h_v_Kf_OtherInBillList"); |
| | | } |
| | | |
| | | foreach (DataColumn col in ds.Tables[0].Columns)//遍历ds中第一个表(Tables[0])的所有列(Columns)每次循环中,col变量会持有当前列的引用 |
| | | { |
| | | Type dataType = col.DataType; //获取当前数据类型传入 自定义变量datadataType |
| | | string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}"; //字符串拼接 // 将列名和数据类型信息拼接成一个JSON格式的字符串 |
| | | columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//获取到DataColumn列对象的列名 |
| | | } |
| | | //if (ds.Tables[0].Rows.Count != 0 || ds != null) |
| | | //{ |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "Sucess!"; |
| | | objJsonResult.data = ds.Tables[0]; |
| | | objJsonResult.data = ds.Tables[0];//代码将第一个DataTable(索引为0)赋值给objJsonResult的data属性 |
| | | objJsonResult.list = columnNameList;//将columnNameList赋值给objJsonResult的list属性 |
| | | return objJsonResult; |
| | | //} |
| | | //else |
| | |
| | | } |
| | | //================================================================================== |
| | | |
| | | |
| | | //进行 会计期间 结账 的判断和控制 |
| | | int sYear = 0; |
| | | int sPeriod = 0; |
| | | DateTime HDate = DateTime.Now; |
| | | if (DBUtility.Xt_BaseBillFun.Fun_AllowYearPeriod(HDate, ref sYear, ref sPeriod, ref s) == false) |
| | | { |
| | | objJsonResult.Message = s; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | oCN.BeginTran(); |
| | | |
| | |
| | | { |
| | | try |
| | | { |
| | | List<object> columnNameList = new List<object>(); //定义声明变量 ,把通过 new List<object>()创建的 实例,赋值给变量 |
| | | //判断是否有查询权限 |
| | | if (!DBUtility.ClsPub.Security_Log("Kf_EntrustInBillQuery", 1, false, user)) |
| | | { |
| | |
| | | string sql = "select * from h_v_Kf_EntrustInBillList where 1 = 1 " + sWhere+ " order by hmainid desc"; |
| | | ds = oCN.RunProcReturn(sql, "h_v_Kf_EntrustInBillList"); |
| | | } |
| | | foreach (DataColumn col in ds.Tables[0].Columns)//遍历ds中第一个表(Tables[0])的所有列(Columns)每次循环中,col变量会持有当前列的引用 |
| | | { |
| | | Type dataType = col.DataType; //获取当前数据类型传入 自定义变量datadataType |
| | | string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}"; //字符串拼接 // 将列名和数据类型信息拼接成一个JSON格式的字符串 |
| | | columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//获取到DataColumn列对象的列名 |
| | | } |
| | | |
| | | //if (ds.Tables[0].Rows.Count != 0 || ds != null) |
| | | //{ |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "Sucess!"; |
| | | objJsonResult.data = ds.Tables[0]; |
| | | objJsonResult.data = ds.Tables[0];//代码将第一个DataTable(索引为0)赋值给objJsonResult的data属性 |
| | | objJsonResult.list = columnNameList;//将columnNameList赋值给objJsonResult的list属性 |
| | | return objJsonResult; |
| | | //} |
| | | //else |
| | |
| | | foreach (Model.ClsSb_MouldRepairWorkBillMain oItem in lsmain) |
| | | { |
| | | //oItem.HMaker = ""; |
| | | UserName = oItem.HMaker; //制单人 |
| | | UserName = msg4; //制单人 |
| | | oItem.HBillType = "3807"; |
| | | oItem.HBillSubType = "3807"; |
| | | //oItem.HBillNo = ""; //单据号 |
| | |
| | | { |
| | | |
| | | //ds = oCN.RunProcReturn("select HRepairCheckID,HRepairCheckContent,HManagerID,HRemark from Sc_MouldRepairCheckBillSub", "Sc_MouldRepairCheckBillSub"); |
| | | ds = oCN.RunProcReturn("select HRepairCheckID,验收项目代码 HRepairCheckCode,验收项目 HRepairCheckName,验收内容 HRepairCheckContent,HManagerSonID HManagerID,子负责人代码 HManagerCode,子负责人 HManagerName,备注 HRemark from h_v_Sc_MouldRepairCheckBillList_Edit", "h_v_Sc_MouldRepairCheckBillList_Edit"); |
| | | ds = oCN.RunProcReturn("select * from h_v_Sc_MouldRepairCheckBillList_Edit", "h_v_Sc_MouldRepairCheckBillList_Edit"); |
| | | |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | |
| | | { |
| | | |
| | | //string sql1 = "select HRepairCheckID,HRepairCheckContent,HManagerID,HRemark from Sc_MouldRepairCheckBillSub where 1 = 1 "; |
| | | string sql1 = "select HRepairCheckID,验收项目代码 HRepairCheckCode,验收项目 HRepairCheckName,验收内容 HRepairCheckContent,HManagerSonID HManagerID,子负责人代码 HManagerCode,子负责人 HManagerName,备注 HRemark from h_v_Sc_MouldRepairCheckBillList_Edit where 1 = 1 "; |
| | | string sql1 = "select * from h_v_Sc_MouldRepairCheckBillList_Edit where 1 = 1 "; |
| | | string sql = sql1 + sqlWhere; |
| | | ds = oCN.RunProcReturn(sql, "h_v_Sc_MouldRepairCheckBillList_Edit"); |
| | | |
| | |
| | | foreach (Model.ClsSc_MouldConkBookBillMain oItem in lsmain) |
| | | { |
| | | //oItem.HMaker = ""; |
| | | UserName = oItem.HMaker; //制单人 |
| | | UserName = msg4; //制单人 |
| | | DBUtility.ClsPub.CurUserName = UserName; |
| | | oItem.HBillType = "3815"; |
| | | oItem.HBillSubType = "3815"; |
| | |
| | | |
| | | DAL.ClsSc_MouldMaintainPlanBill oBill = new DAL.ClsSc_MouldMaintainPlanBill(); |
| | | List<Model.ClsSc_MouldMaintainPlanBillMain> lsmain = new List<Model.ClsSc_MouldMaintainPlanBillMain>(); |
| | | |
| | | msg2 = msg2.Replace("\\", ""); |
| | | msg2 = msg2.Replace("\n", ""); //\n |
| | | lsmain = oListModels.getObjectByJson_Gy_MouldMaintainPlanBillMain(msg2); |
| | |
| | | UserName = oItem.HMaker; //制单人 |
| | | oItem.HBillType = "3818"; |
| | | oItem.HBillSubType = "3818"; |
| | | oItem.HMainSourceInterID = oItem.HMouldMaintainRuleID; |
| | | oItem.HMainSourceBillNo = oItem.HMouldMaintainRuleNo; |
| | | |
| | | //oItem.HInterID =0; |
| | | //oItem.HBillNo = ""; |
| | |
| | | { |
| | | SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); |
| | | //获取保养项目编辑数据 |
| | | string sql = "select 保养项目ID HMaintainItemID, 保养项目代码 HMaintainItemNumber,保养项目 HMaintainItem,保养部位 HMaintainPart,具体要求 HClaim,负责人ID,负责人代码 HManagerNumber,负责人名称 HManagerName,子备注2 HRemark,HMouldMaintainRuleID,HEquipDotCheckNo from h_v_Sc_MouldMaintainPlanBillSub_Item where 1 = 1 " + sqlWhere + ""; |
| | | string sql = "select 保养项目ID HMaintainItemID, 保养项目代码 HMaintainItemNumber,保养项目 HMaintainItem,保养部位 HMaintainPart,具体要求 HClaim,负责人ID HManagerID,负责人代码 HManagerNumber,负责人名称 HManagerName,子备注2 HRemark,HMouldMaintainRuleID,HEquipDotCheckNo from h_v_Sc_MouldMaintainPlanBillSub_Item where 1 = 1 " + sqlWhere + ""; |
| | | |
| | | ds = oCN.RunProcReturn(sql, "h_v_Sc_MouldMaintainPlanBillSub_Item"); |
| | | //获取配件项目编辑数据 |
| | |
| | | return objJsonResult; |
| | | } |
| | | #endregion |
| | | |
| | | #region[器具保养记录表,选保养计划获取保养计划清单信息] |
| | | [Route("Sc_MouldMaintainPlanBill/Sc_MouldMaintainPlanBill_PlanList")] |
| | | [HttpGet] |
| | | public object Sc_MouldMaintainPlanBill_PlanList(string HInterID, string HDate) |
| | | { |
| | | DataSet ds, ds1; |
| | | try |
| | | { |
| | | SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); |
| | | |
| | | List<DataTable> tableList = new List<DataTable>(); |
| | | |
| | | //获取保养项目 |
| | | ds = oCN.RunProcReturn("exec h_p_Sc_MouldMaintain_GetPlanList " + HInterID + ",'" + HDate + "'", "h_p_Sc_MouldMaintain_GetPlanList"); |
| | | |
| | | //获取配件项目编辑数据 |
| | | string sql1 = "select 配件ID HMaterID, 配件代码 HMaterNumber,配件名称 HMaterName,单位ID HUnitID,计量单位代码 HUnitNumber,计量单位名称 HUnitName,用量 HQty,标准用量 HQtyMust,子备注1 HRemark,规格型号 HMaterSpec from h_v_Sc_MouldMaintainPlanBillSub where hmainid = " + HInterID + ""; |
| | | ds1 = oCN.RunProcReturn(sql1, "h_v_Sc_MouldMaintainPlanBillSub"); |
| | | |
| | | tableList.Add(ds.Tables[0]); |
| | | tableList.Add(ds1.Tables[0]); |
| | | |
| | | if (ds.Tables[0].Rows.Count != 0 || ds != null) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "获取信息成功!"; |
| | | objJsonResult.data = tableList; |
| | | } |
| | | else |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "没有查询到数据信息!"; |
| | | objJsonResult.data = tableList; |
| | | } |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "发生异常,没有返回任何计划!" + e.ToString(); |
| | | objJsonResult.data = null; |
| | | } |
| | | return objJsonResult; |
| | | } |
| | | #endregion |
| | | |
| | | #region [模具保养计划单删除功能] |
| | | /// <summary> |
| | | /// 模具维修单删除功能 |
| | |
| | | } |
| | | #endregion |
| | | |
| | | #region 模具保养记录表 保存/编辑PDA |
| | | /// <summary> |
| | | /// 保存模具维修单 |
| | | /// </summary> |
| | | /// <param name="msg"></param> |
| | | /// <returns></returns> |
| | | [Route("Sc_MouldMaintainBill/SaveGetMouldMaintainBillListPDA")] |
| | | [HttpPost] |
| | | public object SaveGetMouldMaintainBillListPDA([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 msg5 = sArray[2].ToString(); |
| | | |
| | | string UserName = ""; |
| | | ListModels oListModels = new ListModels(); |
| | | try |
| | | { |
| | | if (!DBUtility.ClsPub.Security_Log("Sc_MouldMaintainBill_Edit", 1, false, msg5)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "无保存权限!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | DAL.ClsSc_MouldMaintainBill oBill = new DAL.ClsSc_MouldMaintainBill(); |
| | | List<Model.ClsSc_MouldMaintainBillMain> lsmain = new List<Model.ClsSc_MouldMaintainBillMain>(); |
| | | msg2 = msg2.Replace("\\", ""); |
| | | msg2 = msg2.Replace("\n", ""); //\n |
| | | lsmain = oListModels.getObjectByJson_Sc_MouldMaintainBillMain(msg2); |
| | | foreach (Model.ClsSc_MouldMaintainBillMain oItem in lsmain) |
| | | { |
| | | UserName = oItem.HMaker; //制单人 |
| | | DBUtility.ClsPub.CurUserName = UserName; |
| | | oItem.HBillType = "3819"; |
| | | oItem.HBillSubType = "3819"; |
| | | |
| | | //oItem.HInterID =0; |
| | | //oItem.HBillNo = ""; |
| | | oItem.HDate = DBUtility.ClsPub.isDate(DateTime.Now.ToString("yyyy-MM-dd"));// --日期 |
| | | oItem.HYear = DBUtility.ClsPub.isLong(DateTime.Now.Year); |
| | | //oItem.HMakeDate = ""; |
| | | //oItem.HYear = ""; |
| | | //oItem.HPeriod = ""; |
| | | //oItem.HRemark = ""; |
| | | //oItem.HCycleUnit = ""; |
| | | //oItem.HCheckCycle = ""; |
| | | //oItem.HBeginDate = ""; |
| | | //oItem.HEndDate = ""; |
| | | //oItem.HInnerBillNo = ""; |
| | | //oItem.HExplanation = ""; |
| | | |
| | | //oItem.HInterID = DBUtility.ClsPub.CreateBillID_SRMProd("1103", ref DBUtility.ClsPub.sExeReturnInfo); |
| | | if (DBUtility.ClsPub.isStrNull(oItem.HDate) == "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "保存失败!没有单据日期,无法保存!"; |
| | | objJsonResult.data = 1; |
| | | return objJsonResult; |
| | | } |
| | | oBill.omodel = oItem; |
| | | } |
| | | //保养项表体数据 |
| | | //按 },{来拆分数组 //去掉【和】 |
| | | msg3 = msg3.Substring(1, msg3.Length - 2); |
| | | msg3 = msg3.Replace("\\", ""); |
| | | msg3 = msg3.Replace("\n", ""); //\n |
| | | //msg2 = msg2.Replace("'", "’"); |
| | | List<Model.ClsSc_MouldMaintainRuleBillSub_Item> ls = new List<Model.ClsSc_MouldMaintainRuleBillSub_Item>(); |
| | | ls = oListModels.getObjectByJson_Sc_MouldMaintainRuleBillSub_Item(msg3); |
| | | int i = 0; |
| | | foreach (Model.ClsSc_MouldMaintainRuleBillSub_Item oItemSub in ls) |
| | | { |
| | | |
| | | i++; |
| | | oItemSub.HEntryID = i; |
| | | //oItemSub.HCloseMan = ""; //行关闭 |
| | | oItemSub.HEntryCloseDate = DBUtility.ClsPub.isDate(DateTime.Now); |
| | | oItemSub.HCloseType = false; //关闭类型 |
| | | //oItemSub.HRemark = ""; //备注 |
| | | oItemSub.HSourceInterID = 0; // 源单主内码 |
| | | oItemSub.HSourceEntryID = 0; //源单子内码 |
| | | //oItemSub.HSourceBillNo = ""; //源单单号 |
| | | //oItemSub.HSourceBillType = ""; //源单类型 |
| | | oItemSub.HRelationQty = 0; //关联数量 |
| | | oBill.DetailCol.Add(oItemSub); |
| | | |
| | | } |
| | | |
| | | //保存 |
| | | //保存完毕后处理 |
| | | bool bResult; |
| | | if (oBill.omodel.HInterID == 0) |
| | | { |
| | | // bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); |
| | | bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); |
| | | } |
| | | else |
| | | { |
| | | bResult = oBill.ModifyBill(oBill.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; |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #region[模具保养记录表编辑时获取表头数据] |
| | | [Route("Sc_MouldMaintainBill/Sc_MouldMaintainBillListCheckDetai")] |
| | | [HttpGet] |
| | |
| | | } |
| | | SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); |
| | | //获取保养项目编辑数据 |
| | | string sql = "select HMaintainItemID, 保养项目代码 HMaintainItemNumber,保养项目名称 HMaintainItem,保养部位 HMaintainPart,具体要求 HClaim,HManagerID,负责人代码 HManagerNumber,负责人 HManagerName,表体备注 HRemark from h_v_Sc_MouldMaintainBillListItem where 1 = 1 " + Swhere + ""; |
| | | string sql = "select HMaintainItemID, 保养项目代码 HMaintainItemNumber,保养项目名称 HMaintainItem,保养部位 HMaintainPart,具体要求 HClaim,HManagerID,负责人代码 HManagerNumber,负责人 HManagerName,表体备注 HRemark,保养结果 HMaintainResult from h_v_Sc_MouldMaintainBillListItem where 1 = 1 " + Swhere + ""; |
| | | ds = oCN.RunProcReturn(sql, "h_v_Sc_MouldMaintainBillListItem"); |
| | | //获取配件项目编辑数据 |
| | | string sql1 = "select HMaterID, 配件代码 HMaterNumber,配件名称 HMaterName,规格型号 HMaterSpec,HUnitID,单位代码 HUnitNumber,单位名称 HUnitName,实际用量 HQty,标准用量 HQtyMust,HManagerID,负责人代码 HManagerNumber,负责人 HManagerName,表体备注 HRemark from h_v_Sc_MouldMaintainBillList where 1 = 1 " + Swhere + ""; |
| | |
| | | return objJsonResult; |
| | | } |
| | | |
| | | bool IsDete = oBill.DeleteBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo); |
| | | if (IsDete) |
| | | //=========================================Begin 删除前控制 Begin========================================= |
| | | string sql1 = "exec h_p_Sc_MouldMaintainBill_BeforeDelCtrl " + HInterID + "," + user; |
| | | ds = oCN.RunProcReturn(sql1, "h_p_Sc_MouldMaintainBill_BeforeDelCtrl"); |
| | | 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 (ds.Tables[0].Rows[0]["HBack"].ToString() != "0") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "删除失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | //===========================================End 删除前控制 End=========================================== |
| | | |
| | | bool IsDete = oBill.DeleteBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo); |
| | | |
| | | //=========================================Begin 删除后控制 Begin========================================= |
| | | string sql2 = "exec h_p_Sc_MouldMaintainBill_AfterDelCtrl " + HInterID + "," + user; |
| | | ds = oCN.RunProcReturn(sql2, "h_p_Sc_MouldMaintainBill_AfterDelCtrl"); |
| | | 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 (ds.Tables[0].Rows[0]["HBack"].ToString() != "0") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "删除失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | //===========================================End 删除后控制 End=========================================== |
| | | |
| | | if (IsDete) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = DBUtility.ClsPub.sExeReturnInfo; |
| | |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据未找到"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #region 模具保养记录单审核/反审核功能 |
| | | [Route("Sc_MouldMaintainBill/CheckSc_MouldMaintainBill")] |
| | | [HttpGet] |
| | | public object CheckSc_MouldMaintainBill(string HInterID, int Type, string user, string HBillSubType) |
| | | { |
| | | DAL.ClsSc_MouldMaintainBill BillOld = new DAL.ClsSc_MouldMaintainBill(); |
| | | try |
| | | { |
| | | //判断是否有审核权限 |
| | | if (!DBUtility.ClsPub.Security_Log("Sc_MouldMaintainBill_Check", 1, false, user)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "没有审核权限!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | if (string.IsNullOrWhiteSpace(HInterID)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "HInterID为空!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | ClsPub.CurUserName = user; |
| | | BillOld.MvarItemKey = "Sc_MouldMaintainBillMain"; |
| | | oCN.BeginTran();//开始事务 |
| | | |
| | | //Type 1 审核 2 反审核 |
| | | if (Type == 1) |
| | | { |
| | | //判断单据是否已经审核 |
| | | DataSet ds; |
| | | string sql = "select * from " + BillOld.MvarItemKey + " where HinterID = " + HInterID; |
| | | ds = oCN.RunProcReturn(sql, BillOld.MvarItemKey); |
| | | if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0) |
| | | { |
| | | if (ds.Tables[0].Rows[0]["HChecker"] != null && ds.Tables[0].Rows[0]["HChecker"].ToString() != "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据已审核!不需要再审核!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | |
| | | //审核前控制 |
| | | string HBillNo = ds.Tables[0].Rows[0]["HBillNo"].ToString(); |
| | | sql = "exec h_p_Sc_MouldMaintainBill_BeforeCheckCtrl " + int.Parse(HInterID) + ",'" + HBillNo + "','" + user + "'"; |
| | | ds = oCN.RunProcReturn(sql, "h_p_Sc_MouldMaintainBill_BeforeCheckCtrl"); |
| | | if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "审核失败!原因:审核前判断失败,请与网络管理人员联系"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | |
| | | } |
| | | if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | |
| | | //审核单据 |
| | | if (!BillOld.CheckBill(Int64.Parse(HInterID), HBillNo, "h_p_Sc_MouldMaintainBill_AfterCheckCtrl", user, ref ClsPub.sExeReturnInfo)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "审核失败!原因:" + ClsPub.sExeReturnInfo; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | //判断单据是否已经反审核 |
| | | DataSet ds; |
| | | string sql = "select * from " + BillOld.MvarItemKey + " where HinterID = " + HInterID; |
| | | ds = oCN.RunProcReturn(sql, BillOld.MvarItemKey); |
| | | if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0) |
| | | { |
| | | if (ds.Tables[0].Rows[0]["HChecker"] == null || ds.Tables[0].Rows[0]["HChecker"].ToString() == "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据已反审核!不需要再反审核!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | |
| | | //反审核前控制 |
| | | string HBillNo = ds.Tables[0].Rows[0]["HBillNo"].ToString(); |
| | | sql = "exec h_p_Sc_MouldMaintainBill_BeforeUnCheckCtrl " + int.Parse(HInterID) + ",'" + HBillNo + "','" + user + "'"; |
| | | ds = oCN.RunProcReturn(sql, "h_p_Sc_MouldMaintainBill_BeforeUnCheckCtrl"); |
| | | if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "反审核失败!原因:反审核前判断失败,请与网络管理人员联系"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | |
| | | } |
| | | if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "反审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | //反审核单据 |
| | | if (!BillOld.AbandonCheck(Int64.Parse(HInterID), HBillNo, "h_p_Sc_MouldMaintainBill_AfterUnCheckCtrl", user, ref ClsPub.sExeReturnInfo)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "审核失败!原因:" + ClsPub.sExeReturnInfo; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | |
| | | oCN.Commit();//提交事务 |
| | | |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "执行成功!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; ; |
| | | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "执行失败!" + e.ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | |
| | | { |
| | | SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); |
| | | //获取点检项目编辑数据 |
| | | ds = oCN.RunProcReturn("select HDotCheckItem, HDotCheckPart , HClaim, a.HRemark,a.HManagerID,e.HNumber HManagerCode,e.HName HManagerName from Sc_MouldDotCheckBillSub a left join Gy_Employee e on a.HManagerID=e.HItemID where 1=1 " + sqlWhere, "Sc_MouldDotCheckBillSub"); |
| | | ds = oCN.RunProcReturn("select * from h_v_Sc_MouldDotCheckBill_Edit where 1=1 " + sqlWhere, "h_v_Sc_MouldDotCheckBill_Edit"); |
| | | //获取配件项目编辑数据 |
| | | ds1 = oCN.RunProcReturn(@"select b.HMaterID, mt.Hnumber HMaterNumber ,mt.HName HMaterName, b.HUnitID |
| | | ,u2.hnumber HUnitNumber,u2.HName HUnitName,b.HQty,b.HQtyMust,b.HRemark |
| | |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "获取信息成功!"; |
| | | objJsonResult.data = null; |
| | | objJsonResult.data = ds.Tables[0]; |
| | | objJsonResult.list = list; |
| | | |
| | | } |
| | |
| | | { |
| | | SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); |
| | | //获取点检项目编辑数据 |
| | | ds = oCN.RunProcReturn(@"select a.HDotCheckItemID,HDotCheckItem, HDotCheckPart , HClaim, a.HRemark,a.HManagerID,e.HNumber HManagerCode,e.HName HManagerName from Sc_MouldDotCheckPlanBillSub a |
| | | left join Gy_Employee e on a.HManagerID=e.HItemID |
| | | ds = oCN.RunProcReturn(@"select * from h_v_Sc_MouldDotCheckPlanBill_Edit |
| | | where 1=1 " + sqlWhere, "Sc_MouldDotCheckPlanBillSub"); |
| | | ////获取配件项目编辑数据 |
| | | //ds1 = oCN.RunProcReturn(@"select b.HMaterID, mt.Hnumber HMaterNumber ,mt.HName HMaterName, b.HUnitID |
| | |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "获取信息成功!"; |
| | | objJsonResult.data = null; |
| | | objJsonResult.data = ds.Tables[0]; |
| | | objJsonResult.list = list; |
| | | } |
| | | catch (Exception e) |
| | |
| | | } |
| | | #endregion |
| | | |
| | | #region 器具点检计划单审核/反审核功能 |
| | | [Route("Sc_MouldDotCheckPlanBill/CheckSc_MouldDotCheckPlanBill")] |
| | | [HttpGet] |
| | | public object CheckSc_MouldDotCheckPlanBill(string HInterID, int Type, string user) |
| | | { |
| | | DAL.ClsSc_MouldDotCheckPlanBill BillOld = new DAL.ClsSc_MouldDotCheckPlanBill(); |
| | | try |
| | | { |
| | | //判断是否有审核权限 |
| | | if (!DBUtility.ClsPub.Security_Log("Sc_MouldDotCheckPlanBill_Check", 1, false, user)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "无权限审核!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | if (string.IsNullOrWhiteSpace(HInterID)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "HInterID为空!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | ClsPub.CurUserName = user; |
| | | oCN.BeginTran();//开始事务 |
| | | |
| | | //Type 1 审核 2 反审核 |
| | | if (Type == 1) |
| | | { |
| | | if (!BillOld.CheckBill(int.Parse(HInterID), ref ClsPub.sExeReturnInfo)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "审核失败!原因:" + ClsPub.sExeReturnInfo; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | //自动生成点检计划单 |
| | | oCN.RunProc("exec h_p_Sc_MouldDotCheckPlan_Auto " + HInterID); |
| | | } |
| | | else |
| | | { |
| | | if (BillOld.AbandonCheck(int.Parse(HInterID), ref ClsPub.sExeReturnInfo)) |
| | | { |
| | | SQLHelper.ClsCN oCn = new SQLHelper.ClsCN(); |
| | | } |
| | | else |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "审核失败!原因:" + ClsPub.sExeReturnInfo; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | |
| | | oCN.Commit();//提交事务 |
| | | |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "执行成功!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; ; |
| | | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "执行失败!" + e.ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #region[器具点检计划表编辑时获取表体数据--保养计划] |
| | | [Route("Sc_MouldDotCheckPlanBill/GetPlanList")] |
| | | [HttpGet] |
| | | public object GetPlanList_Check(string sqlWhere) |
| | | { |
| | | DataSet ds; |
| | | try |
| | | { |
| | | SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); |
| | | if (sqlWhere == null || sqlWhere.Equals("")) |
| | | { |
| | | ds = oCN.RunProcReturn("select * from h_v_Sc_MouldDotCheckPlanList", "h_v_Sc_MouldDotCheckPlanList"); |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "获取信息成功!"; |
| | | objJsonResult.data = ds.Tables[0]; |
| | | } |
| | | else |
| | | { |
| | | string sql1 = "select * from h_v_Sc_MouldDotCheckPlanList where 1 = 1 "; |
| | | string sql = sql1 + sqlWhere; |
| | | ds = oCN.RunProcReturn(sql, "h_v_Sc_MouldDotCheckPlanList"); |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "获取信息成功!"; |
| | | objJsonResult.data = ds.Tables[0]; |
| | | } |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "没有返回任何计划!" + e.ToString(); |
| | | objJsonResult.data = null; |
| | | } |
| | | return objJsonResult; |
| | | } |
| | | #endregion |
| | | |
| | | #endregion |
| | | |
| | | |
| | | #region 根据器具条码查找器具档案信息PDA |
| | | [Route("QJ_PDA_MouldDotCheckBill/txtHBarCode_KeyDown")] |
| | | [HttpGet] |
| | | public object txtHBarCode_KeyDown(string HBarCode) |
| | | { |
| | | try |
| | | { |
| | | if (HBarCode == null || HBarCode.Equals("")) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "条形码不能为空!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | //得到信息 |
| | | ds = oCN.RunProcReturn("select top 1 * from Gy_MouldFileMain where HBarCode= '" + HBarCode + "'", "Gy_MouldFileMain"); |
| | | //写入信息 |
| | | if (ds == null || ds.Tables[0].Rows.Count == 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "未查询到器具信息!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "Sucess!"; |
| | | objJsonResult.data = ds.Tables[0]; |
| | | return objJsonResult; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "Exception!" + e.ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #region 模具报废入库单 |
| | | |
| | |
| | | } |
| | | #endregion |
| | | |
| | | #region 模具报废入库单保存/编辑 |
| | | #region 模具报废入库单保存/编辑 20240702作废 |
| | | /// <summary> |
| | | /// 保存模具报废入库单 |
| | | /// </summary> |
| | | /// <param name="msg"></param> |
| | | /// <returns></returns> |
| | | //[Route("Sc_MouldScrapInHouseBill/SaveGetMouldScrapInHouseBillList")] |
| | | //[HttpPost] |
| | | //public object SaveGetMouldScrapInHouseBillList([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 refSav = sArray[2].ToString(); |
| | | // string msg4 = sArray[3].ToString(); |
| | | |
| | | // string UserName = ""; |
| | | // string s = ""; |
| | | // ListModels oListModels = new ListModels(); |
| | | // try |
| | | // { |
| | | // //编辑权限 |
| | | // if (!DBUtility.ClsPub.Security_Log("Sc_MouldScrapRequestBill_Edit", 1, false, msg4)) |
| | | // { |
| | | // objJsonResult.code = "0"; |
| | | // objJsonResult.count = 0; |
| | | // objJsonResult.Message = "无保存权限!"; |
| | | // objJsonResult.data = null; |
| | | // return objJsonResult; |
| | | // } |
| | | |
| | | // DLL.ClsSc_MouldScrapInBill oBill = new DLL.ClsSc_MouldScrapInBill(); |
| | | // List<Models.ClsSc_MouldStockBillMain> lsmain = new List<Models.ClsSc_MouldStockBillMain>(); |
| | | // msg2 = msg2.Replace("\\", ""); |
| | | // msg2 = msg2.Replace("\n", ""); //\n |
| | | // lsmain = oListModels.getObjectByJson_Gy_MouldScrapInHouseBillMain(msg2); |
| | | // foreach (Models.ClsSc_MouldStockBillMain oItem in lsmain) |
| | | // { |
| | | // if (refSav == "Add") |
| | | // { |
| | | // //单据号是否重复 |
| | | // if (BillNew0.IsExistBillNo(ref ClsPub.sExeReturnInfo, oItem.HBillNo, BillStatus, BillOld0.omodel.HInterID)) |
| | | // { |
| | | // objJsonResult.code = "0"; |
| | | // objJsonResult.count = 0; |
| | | // objJsonResult.Message = "单据号重复!不允许保存!"; |
| | | // objJsonResult.data = 1; |
| | | // return objJsonResult; |
| | | // } |
| | | // } |
| | | // if (refSav == "Update") |
| | | // { |
| | | // if (BillOld0.ShowBill(oItem.HInterID, ref s) == false) |
| | | // { |
| | | // objJsonResult.code = "0"; |
| | | // objJsonResult.count = 0; |
| | | // objJsonResult.Message = "此单据有误!"; |
| | | // objJsonResult.data = 1; |
| | | // return objJsonResult; |
| | | // } |
| | | // //判断是否可编辑 |
| | | // if (BillOld0.omodel.HChecker != "" && BillOld0.omodel.HChecker != null) |
| | | // { |
| | | // objJsonResult.code = "0"; |
| | | // objJsonResult.count = 0; |
| | | // objJsonResult.Message = "此单据已经被审核,不允许修改!"; |
| | | // objJsonResult.data = 1; |
| | | // return objJsonResult; |
| | | // } |
| | | // if (BillOld0.omodel.HBillStatus > 1) |
| | | // { |
| | | // objJsonResult.code = "0"; |
| | | // objJsonResult.count = 0; |
| | | // objJsonResult.Message = "此单据处于不可编辑状态,不允许修改!"; |
| | | // objJsonResult.data = 1; |
| | | // return objJsonResult; |
| | | // } |
| | | // if (!DBUtility.Xt_BaseBillFun.Fun_AllowEditBill(BillOld0, ref s)) |
| | | // { |
| | | // objJsonResult.code = "0"; |
| | | // objJsonResult.count = 0; |
| | | // objJsonResult.Message = s + ",不允许修改"; |
| | | // objJsonResult.data = 1; |
| | | // return objJsonResult; |
| | | // } |
| | | // } |
| | | // //oItem.HMaker = ""; |
| | | // UserName = oItem.HMaker; //制单人 |
| | | // oItem.HBillType = "3831"; |
| | | // oItem.HBillSubType = "3831"; |
| | | // //oItem.HBillNo = ""; //单据号 |
| | | // //oItem.HDate = DBUtility.ClsPub.isDate(DateTime.Now.ToString("yyyy-MM-dd"));// --日期 |
| | | // //oItem.HInnerBillNo = ""; // --内部单据号 |
| | | // oItem.HYear = DBUtility.ClsPub.isLong(DateTime.Now.Year); |
| | | // oItem.HMakeDate = DBUtility.ClsPub.isStrNull(DateTime.Now.ToString("yyyy-MM-dd")); |
| | | // //oItem.HEquipID = 0; //设备ID(Gy_EquipMent) |
| | | // //oItem.HPeriod = 0; |
| | | // //oItem.HCheckBeginDate = DBUtility.ClsPub.isDate(DateTime.Now.ToString("yyyy-MM-dd")); // --维修日期 |
| | | // //oItem.HCheckResult = ""; //验收结论--(正常,异常) |
| | | // //oItem.HEmpID = 0; //验收人(Gy_Employee) |
| | | // //oItem.HManagerID = 0; //负责人(Gy_Employee) |
| | | // //oItem.HDeptID = 0; //验收部门(Gy_Department) |
| | | // //oItem.HExplanation = ""; //摘要(故障描述) |
| | | // //oItem.HRemark = ""; //备注 |
| | | |
| | | // //oItem.HMainSourceInterID = oItem.HInterID; |
| | | |
| | | // //oItem.HInterID = DBUtility.ClsPub.CreateBillID_SRMProd("1103", ref DBUtility.ClsPub.sExeReturnInfo); |
| | | // if (DBUtility.ClsPub.isStrNull(oItem.HDate) == "") |
| | | // { |
| | | // objJsonResult.code = "0"; |
| | | // objJsonResult.count = 0; |
| | | // objJsonResult.Message = "保存失败!没有单据日期,无法保存!"; |
| | | // objJsonResult.data = 1; |
| | | // return objJsonResult; |
| | | // } |
| | | // oBill.omodel = oItem; |
| | | // } |
| | | // //表体数据 |
| | | // //按 },{来拆分数组 //去掉【和】 |
| | | // msg3 = msg3.Substring(1, msg3.Length - 2); |
| | | // msg3 = msg3.Replace("\\", ""); |
| | | // msg3 = msg3.Replace("\n", ""); //\n |
| | | // //msg2 = msg2.Replace("'", "’"); |
| | | // List<Models.ClsSc_MouldStockBillSub> ls = new List<Models.ClsSc_MouldStockBillSub>(); |
| | | // ls = oListModels.getObjectByJson_Gy_MouldScrapInHouseBillSub(msg3); |
| | | // int i = 0; |
| | | // foreach (Models.ClsSc_MouldStockBillSub oItemSub in ls) |
| | | // { |
| | | |
| | | // i++; |
| | | // oItemSub.HEntryID = i; |
| | | |
| | | // //oItemSub.HRepairCheckID = 0; //验收项目ID |
| | | // //oItemSub.HRepairCheckContent = ""; //验收内容 |
| | | // //oItemSub.HManagerID = 0; //负责人ID |
| | | // //oItemSub.HCloseMan = ""; //行关闭 |
| | | // oItemSub.HEntryCloseDate = DBUtility.ClsPub.isDate(DateTime.Now); |
| | | // oItemSub.HCloseType = false; //关闭类型 |
| | | // //oItemSub.HRemark = ""; //备注 |
| | | // oItemSub.HSourceInterID = 0; // 源单主内码 |
| | | // oItemSub.HSourceEntryID = 0; //源单子内码 |
| | | // //oItemSub.HSourceBillNo = ""; //源单单号 |
| | | // //oItemSub.HSourceBillType = ""; //源单类型 |
| | | // //oItemSub.HRelationQty = 0; //关联数量 |
| | | // //oItemSub.HRelationMoney = 0; //关联金额 |
| | | // //oItemSub.HRepairID = 0; //维修项目 |
| | | // //oItemSub.HRepairExplanation =""; //维修要求 |
| | | // //oItemSub.HMoney = 0; //维修费用 |
| | | // oBill.DetailColl.Add(oItemSub); |
| | | |
| | | // } |
| | | // //保存 |
| | | // //保存完毕后处理 |
| | | // bool bResult; |
| | | // if (oBill.omodel.HInterID == 0) |
| | | // { |
| | | // // bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); |
| | | // bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); |
| | | // string sql = string.Format($"exec h_p_Sc_MouldChangeFileStatus 'in','{oBill.omodel.HInterID.ToString()}' "); |
| | | // oCn.RunProc(sql); |
| | | // } |
| | | // else |
| | | // { |
| | | // bResult = oBill.ModifyBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo); |
| | | // //修改成功 |
| | | // //string sql = string.Format($"exec h_p_Sc_MouldChangeNowWHID 1,{oBill.omodel.HInterID.ToString()},' ' "); |
| | | // string sql = string.Format($"exec h_p_Sc_MouldChangeNowWHID "); |
| | | // oCn.RunProc(sql); |
| | | // } |
| | | // 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; |
| | | // } |
| | | //} |
| | | #endregion |
| | | |
| | | #region 模具报废入库单保存/编辑 20240702 |
| | | /// <summary> |
| | | /// 保存模具报废入库单 |
| | | /// </summary> |
| | |
| | | [HttpPost] |
| | | public object SaveGetMouldScrapInHouseBillList([FromBody] JObject msg) |
| | | { |
| | | DAL.ClsSc_MouldScrapInBill oBill = new DAL.ClsSc_MouldScrapInBill(); |
| | | |
| | | 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 refSav = sArray[2].ToString(); |
| | | string msg4 = sArray[3].ToString(); |
| | | |
| | | string UserName = ""; |
| | | string s = ""; |
| | | ListModels oListModels = new ListModels(); |
| | | string sMainStr = sArray[0].ToString(); //主表数据 |
| | | string sSubStr = sArray[1].ToString(); //子表数据 |
| | | string OperationType = sArray[2].ToString(); //操作类型(Add新增、Update编辑) |
| | | string HMaker = sArray[3].ToString(); //制单人 |
| | | try |
| | | { |
| | | //编辑权限 |
| | | if (!DBUtility.ClsPub.Security_Log("Sc_MouldScrapRequestBill_Edit", 1, false, msg4)) |
| | | //判断权限 |
| | | if (OperationType == "Add") |
| | | { |
| | | BillStatus = DBUtility.ClsPub.Enum_BillStatus.BillStatus_AddNew; |
| | | //判断新增权限 |
| | | if (!DBUtility.ClsPub.Security_Log("Sc_MouldScrapRequestBill", 1, false, HMaker)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "您没有该模块新增权限,请与管理员联系!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | BillStatus = DBUtility.ClsPub.Enum_BillStatus.BillStatus_Modify; |
| | | //判断编辑权限 |
| | | if (!DBUtility.ClsPub.Security_Log("Sc_MouldScrapRequestBill_Edit", 1, false, HMaker)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "您没有该模块编辑权限,请与管理员联系!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | //表头赋值 |
| | | sMainStr = sMainStr.Replace("\\", ""); |
| | | sMainStr = sMainStr.Replace("\n", ""); |
| | | sMainStr = "[" + sMainStr.ToString() + "]"; |
| | | List<Model.ClsSc_MouldStockBillMain> lsmain = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsSc_MouldStockBillMain>>(sMainStr); |
| | | foreach (Model.ClsSc_MouldStockBillMain oItem in lsmain) |
| | | { |
| | | //单据号是否重复 |
| | | if (oBill.IsExistBillNo(ref ClsPub.sExeReturnInfo, oItem.HBillNo, BillStatus, oItem.HInterID)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据号重复!不允许保存!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | //判断会计期是否合理 |
| | | string s = ""; |
| | | int sYear = 0; |
| | | int sPeriod = 0; |
| | | if (DBUtility.Xt_BaseBillFun.Fun_AllowYearPeriod(oItem.HDate, ref sYear, ref sPeriod, ref s) == false) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = s; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | oItem.HYear = sYear; |
| | | oItem.HPeriod = sPeriod; |
| | | DBUtility.ClsPub.CurUserName = oItem.HMaker; |
| | | oBill.omodel = oItem; |
| | | } |
| | | //表体赋值 |
| | | //按 },{来拆分数组 //去掉【和】 |
| | | sSubStr = sSubStr.Substring(1, sSubStr.Length - 2); |
| | | sSubStr = sSubStr.Replace("\\", ""); |
| | | sSubStr = sSubStr.Replace("\n", ""); |
| | | sSubStr = "[" + sSubStr.ToString() + "]"; |
| | | List<Model.ClsSc_MouldStockBillSub> ls = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsSc_MouldStockBillSub>>(sSubStr); |
| | | int i = 0; |
| | | foreach (Model.ClsSc_MouldStockBillSub oItemSub in ls) |
| | | { |
| | | i++; |
| | | oItemSub.HEntryID = i; |
| | | oBill.DetailColl.Add(oItemSub); |
| | | } |
| | | |
| | | string sErrMsg = ""; |
| | | bool bResult; |
| | | //获取系统参数 |
| | | if (oSystemParameter.ShowBill(ref sErrMsg) == true) |
| | | { |
| | | //保存 |
| | | if (OperationType == "Add") //新增保存 |
| | | { |
| | | bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); |
| | | |
| | | if (oSystemParameter.omodel.WMS_CampanyName == "四维尔") //系统参数 客户定制化名称 空白为通用 |
| | | { |
| | | //修改器具档案位置 |
| | | string sql = string.Format($"exec h_p_Sc_MouldChangeFileStatus 'in','{oBill.omodel.HInterID.ToString()}' "); |
| | | oCn.RunProc(sql); |
| | | } |
| | | } |
| | | else //编辑保存 |
| | | { |
| | | bResult = oBill.ModifyBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo); |
| | | |
| | | if (oSystemParameter.omodel.WMS_CampanyName == "四维尔") //系统参数 客户定制化名称 空白为通用 |
| | | { |
| | | //修改器具档案位置 |
| | | string sql = string.Format($"exec h_p_Sc_MouldChangeNowWHID "); |
| | | oCn.RunProc(sql); |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "无保存权限!"; |
| | | objJsonResult.Message = "获取系统参数失败! " + sErrMsg; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | DLL.ClsSc_MouldScrapInBill oBill = new DLL.ClsSc_MouldScrapInBill(); |
| | | List<Models.ClsSc_MouldStockBillMain> lsmain = new List<Models.ClsSc_MouldStockBillMain>(); |
| | | msg2 = msg2.Replace("\\", ""); |
| | | msg2 = msg2.Replace("\n", ""); //\n |
| | | lsmain = oListModels.getObjectByJson_Gy_MouldScrapInHouseBillMain(msg2); |
| | | foreach (Models.ClsSc_MouldStockBillMain oItem in lsmain) |
| | | { |
| | | if (refSav == "Add") |
| | | { |
| | | //单据号是否重复 |
| | | if (BillNew0.IsExistBillNo(ref ClsPub.sExeReturnInfo, oItem.HBillNo, BillStatus, BillOld0.omodel.HInterID)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据号重复!不允许保存!"; |
| | | objJsonResult.data = 1; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | if (refSav == "Update") |
| | | { |
| | | if (BillOld0.ShowBill(oItem.HInterID, ref s) == false) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "此单据有误!"; |
| | | objJsonResult.data = 1; |
| | | return objJsonResult; |
| | | } |
| | | //判断是否可编辑 |
| | | if (BillOld0.omodel.HChecker != "" && BillOld0.omodel.HChecker != null) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "此单据已经被审核,不允许修改!"; |
| | | objJsonResult.data = 1; |
| | | return objJsonResult; |
| | | } |
| | | if (BillOld0.omodel.HBillStatus > 1) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "此单据处于不可编辑状态,不允许修改!"; |
| | | objJsonResult.data = 1; |
| | | return objJsonResult; |
| | | } |
| | | if (!DBUtility.Xt_BaseBillFun.Fun_AllowEditBill(BillOld0, ref s)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = s + ",不允许修改"; |
| | | objJsonResult.data = 1; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | //oItem.HMaker = ""; |
| | | UserName = oItem.HMaker; //制单人 |
| | | oItem.HBillType = "3831"; |
| | | oItem.HBillSubType = "3831"; |
| | | //oItem.HBillNo = ""; //单据号 |
| | | //oItem.HDate = DBUtility.ClsPub.isDate(DateTime.Now.ToString("yyyy-MM-dd"));// --日期 |
| | | //oItem.HInnerBillNo = ""; // --内部单据号 |
| | | oItem.HYear = DBUtility.ClsPub.isLong(DateTime.Now.Year); |
| | | oItem.HMakeDate = DBUtility.ClsPub.isStrNull(DateTime.Now.ToString("yyyy-MM-dd")); |
| | | //oItem.HEquipID = 0; //设备ID(Gy_EquipMent) |
| | | //oItem.HPeriod = 0; |
| | | //oItem.HCheckBeginDate = DBUtility.ClsPub.isDate(DateTime.Now.ToString("yyyy-MM-dd")); // --维修日期 |
| | | //oItem.HCheckResult = ""; //验收结论--(正常,异常) |
| | | //oItem.HEmpID = 0; //验收人(Gy_Employee) |
| | | //oItem.HManagerID = 0; //负责人(Gy_Employee) |
| | | //oItem.HDeptID = 0; //验收部门(Gy_Department) |
| | | //oItem.HExplanation = ""; //摘要(故障描述) |
| | | //oItem.HRemark = ""; //备注 |
| | | |
| | | //oItem.HMainSourceInterID = oItem.HInterID; |
| | | |
| | | //oItem.HInterID = DBUtility.ClsPub.CreateBillID_SRMProd("1103", ref DBUtility.ClsPub.sExeReturnInfo); |
| | | if (DBUtility.ClsPub.isStrNull(oItem.HDate) == "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "保存失败!没有单据日期,无法保存!"; |
| | | objJsonResult.data = 1; |
| | | return objJsonResult; |
| | | } |
| | | oBill.omodel = oItem; |
| | | } |
| | | //表体数据 |
| | | //按 },{来拆分数组 //去掉【和】 |
| | | msg3 = msg3.Substring(1, msg3.Length - 2); |
| | | msg3 = msg3.Replace("\\", ""); |
| | | msg3 = msg3.Replace("\n", ""); //\n |
| | | //msg2 = msg2.Replace("'", "’"); |
| | | List<Models.ClsSc_MouldStockBillSub> ls = new List<Models.ClsSc_MouldStockBillSub>(); |
| | | ls = oListModels.getObjectByJson_Gy_MouldScrapInHouseBillSub(msg3); |
| | | int i = 0; |
| | | foreach (Models.ClsSc_MouldStockBillSub oItemSub in ls) |
| | | { |
| | | |
| | | i++; |
| | | oItemSub.HEntryID = i; |
| | | |
| | | //oItemSub.HRepairCheckID = 0; //验收项目ID |
| | | //oItemSub.HRepairCheckContent = ""; //验收内容 |
| | | //oItemSub.HManagerID = 0; //负责人ID |
| | | //oItemSub.HCloseMan = ""; //行关闭 |
| | | oItemSub.HEntryCloseDate = DBUtility.ClsPub.isDate(DateTime.Now); |
| | | oItemSub.HCloseType = false; //关闭类型 |
| | | //oItemSub.HRemark = ""; //备注 |
| | | oItemSub.HSourceInterID = 0; // 源单主内码 |
| | | oItemSub.HSourceEntryID = 0; //源单子内码 |
| | | //oItemSub.HSourceBillNo = ""; //源单单号 |
| | | //oItemSub.HSourceBillType = ""; //源单类型 |
| | | //oItemSub.HRelationQty = 0; //关联数量 |
| | | //oItemSub.HRelationMoney = 0; //关联金额 |
| | | //oItemSub.HRepairID = 0; //维修项目 |
| | | //oItemSub.HRepairExplanation =""; //维修要求 |
| | | //oItemSub.HMoney = 0; //维修费用 |
| | | oBill.DetailColl.Add(oItemSub); |
| | | |
| | | } |
| | | //保存 |
| | | //保存完毕后处理 |
| | | bool bResult; |
| | | if (oBill.omodel.HInterID == 0) |
| | | { |
| | | // bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); |
| | | bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); |
| | | string sql = string.Format($"exec h_p_Sc_MouldChangeFileStatus 'in','{oBill.omodel.HInterID.ToString()}' "); |
| | | oCn.RunProc(sql); |
| | | } |
| | | else |
| | | { |
| | | bResult = oBill.ModifyBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo); |
| | | //修改成功 |
| | | //string sql = string.Format($"exec h_p_Sc_MouldChangeNowWHID 1,{oBill.omodel.HInterID.ToString()},' ' "); |
| | | string sql = string.Format($"exec h_p_Sc_MouldChangeNowWHID "); |
| | | oCn.RunProc(sql); |
| | | } |
| | | if (bResult) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "保存成功!"; |
| | | //WebAPIController.Add_Log("送货单下推", UserName, "生成送货单"); |
| | | objJsonResult.data = 1; |
| | | objJsonResult.Message = DBUtility.ClsPub.sExeReturnInfo; //成功! |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | else |
| | |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "保存失败!" + DBUtility.ClsPub.sExeReturnInfo; |
| | | objJsonResult.data = 1; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "保存失败!" + e.ToString(); |
| | | objJsonResult.data = 1; |
| | | objJsonResult.Message = "保存失败!" + e.Message; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | |
| | | } |
| | | #endregion |
| | | |
| | | #region 模具处理出库单保存/编辑 |
| | | #region 模具处理出库单保存/编辑 20240702作废 |
| | | /// <summary> |
| | | /// 保存模具处理出库单 |
| | | /// </summary> |
| | | /// <param name="msg"></param> |
| | | /// <returns></returns> |
| | | //[Route("Sc_MouldScrapOutHouseBill/SaveGetMouldScrapOutHouseBillList")] |
| | | //[HttpPost] |
| | | //public object SaveGetMouldScrapOutHouseBillList([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 msg4 = sArray[2].ToString(); |
| | | |
| | | // string UserName = ""; |
| | | // ListModels oListModels = new ListModels(); |
| | | // try |
| | | // { |
| | | // //编辑权限 |
| | | // if (!DBUtility.ClsPub.Security_Log("Sc_MouldScrapOutBill_Edit", 1, false, msg4)) |
| | | // { |
| | | // objJsonResult.code = "0"; |
| | | // objJsonResult.count = 0; |
| | | // objJsonResult.Message = "无保存权限!"; |
| | | // objJsonResult.data = null; |
| | | // return objJsonResult; |
| | | // } |
| | | |
| | | // DLL.ClsSc_MouldScrapOutBill oBill = new DLL.ClsSc_MouldScrapOutBill(); |
| | | // List<Model.ClsSc_MouldStockBillMain> lsmain = new List<Model.ClsSc_MouldStockBillMain>(); |
| | | // msg2 = msg2.Replace("\\", ""); |
| | | // msg2 = msg2.Replace("\n", ""); //\n |
| | | // lsmain = oListModels.getObjectByJson_Gy_MouldScrapOutHouseBillMain(msg2); |
| | | // foreach (Model.ClsSc_MouldStockBillMain oItem in lsmain) |
| | | // { |
| | | // //oItem.HMaker = ""; |
| | | // UserName = oItem.HMaker; //制单人 |
| | | // oItem.HBillType = "3832"; |
| | | // oItem.HBillSubType = "3832"; |
| | | // //oItem.HBillNo = ""; //单据号 |
| | | // //oItem.HDate = DBUtility.ClsPub.isDate(DateTime.Now.ToString("yyyy-MM-dd"));// --日期 |
| | | // //oItem.HInnerBillNo = ""; // --内部单据号 |
| | | // oItem.HYear = DBUtility.ClsPub.isLong(DateTime.Now.Year); |
| | | // oItem.HMakeDate = DBUtility.ClsPub.isStrNull(DateTime.Now.ToString("yyyy-MM-dd")); |
| | | // //oItem.HEquipID = 0; //设备ID(Gy_EquipMent) |
| | | // //oItem.HPeriod = 0; |
| | | // //oItem.HCheckBeginDate = DBUtility.ClsPub.isDate(DateTime.Now.ToString("yyyy-MM-dd")); // --维修日期 |
| | | // //oItem.HCheckResult = ""; //验收结论--(正常,异常) |
| | | // //oItem.HEmpID = 0; //验收人(Gy_Employee) |
| | | // //oItem.HManagerID = 0; //负责人(Gy_Employee) |
| | | // //oItem.HDeptID = 0; //验收部门(Gy_Department) |
| | | // //oItem.HExplanation = ""; //摘要(故障描述) |
| | | // //oItem.HRemark = ""; //备注 |
| | | |
| | | // //oItem.HMainSourceInterID = oItem.HInterID; |
| | | |
| | | // //oItem.HInterID = DBUtility.ClsPub.CreateBillID_SRMProd("1103", ref DBUtility.ClsPub.sExeReturnInfo); |
| | | // if (DBUtility.ClsPub.isStrNull(oItem.HDate) == "") |
| | | // { |
| | | // objJsonResult.code = "0"; |
| | | // objJsonResult.count = 0; |
| | | // objJsonResult.Message = "保存失败!没有单据日期,无法保存!"; |
| | | // objJsonResult.data = 1; |
| | | // return objJsonResult; |
| | | // } |
| | | // oBill.omodel = oItem; |
| | | // } |
| | | // //表体数据 |
| | | // //按 },{来拆分数组 //去掉【和】 |
| | | // msg3 = msg3.Substring(1, msg3.Length - 2); |
| | | // msg3 = msg3.Replace("\\", ""); |
| | | // msg3 = msg3.Replace("\n", ""); //\n |
| | | // //msg2 = msg2.Replace("'", "’"); |
| | | // List<Model.ClsSc_MouldStockBillSub> ls = new List<Model.ClsSc_MouldStockBillSub>(); |
| | | // ls = oListModels.getObjectByJson_Gy_MouldScrapOutHouseBillSub(msg3); |
| | | // int i = 0; |
| | | // foreach (Model.ClsSc_MouldStockBillSub oItemSub in ls) |
| | | // { |
| | | |
| | | // i++; |
| | | // oItemSub.HEntryID = i; |
| | | |
| | | // //oItemSub.HRepairCheckID = 0; //验收项目ID |
| | | // //oItemSub.HRepairCheckContent = ""; //验收内容 |
| | | // //oItemSub.HManagerID = 0; //负责人ID |
| | | // //oItemSub.HCloseMan = ""; //行关闭 |
| | | // oItemSub.HEntryCloseDate = DBUtility.ClsPub.isDate(DateTime.Now); |
| | | // oItemSub.HCloseType = false; //关闭类型 |
| | | // //oItemSub.HRemark = ""; //备注 |
| | | // oItemSub.HSourceInterID = 0; // 源单主内码 |
| | | // oItemSub.HSourceEntryID = 0; //源单子内码 |
| | | // //oItemSub.HSourceBillNo = ""; //源单单号 |
| | | // //oItemSub.HSourceBillType = ""; //源单类型 |
| | | // //oItemSub.HRelationQty = 0; //关联数量 |
| | | // //oItemSub.HRelationMoney = 0; //关联金额 |
| | | // //oItemSub.HRepairID = 0; //维修项目 |
| | | // //oItemSub.HRepairExplanation =""; //维修要求 |
| | | // //oItemSub.HMoney = 0; //维修费用 |
| | | // oBill.DetailColl.Add(oItemSub); |
| | | |
| | | // } |
| | | // //保存 |
| | | // //保存完毕后处理 |
| | | // bool bResult; |
| | | // if (oBill.omodel.HInterID == 0) |
| | | // { |
| | | // // bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); |
| | | // bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); |
| | | // string sql = string.Format($"exec h_p_Sc_MouldChangeFileStatus 'out','{oBill.omodel.HInterID.ToString()}' "); |
| | | // oCn.RunProc(sql); |
| | | // } |
| | | // else |
| | | // { |
| | | // bResult = oBill.ModifyBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo); |
| | | // //修改成功 |
| | | // //string sql = string.Format($"exec h_p_Sc_MouldChangeNowWHID 1,{oBill.omodel.HInterID.ToString()},' ' "); |
| | | // string sql = string.Format($"exec h_p_Sc_MouldChangeNowWHID "); |
| | | // oCn.RunProc(sql); |
| | | // } |
| | | // 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; |
| | | // } |
| | | //} |
| | | #endregion |
| | | |
| | | #region 模具处理出库单保存/编辑 20240702 |
| | | /// <summary> |
| | | /// 保存模具处理出库单 |
| | | /// </summary> |
| | |
| | | [HttpPost] |
| | | public object SaveGetMouldScrapOutHouseBillList([FromBody] JObject msg) |
| | | { |
| | | DAL.ClsSc_MouldScrapOutBill oBill = new DAL.ClsSc_MouldScrapOutBill(); |
| | | |
| | | 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 msg4 = sArray[2].ToString(); |
| | | |
| | | string UserName = ""; |
| | | ListModels oListModels = new ListModels(); |
| | | string sMainStr = sArray[0].ToString(); //主表数据 |
| | | string sSubStr = sArray[1].ToString(); //子表数据 |
| | | string HMaker = sArray[2].ToString(); //制单人 |
| | | try |
| | | { |
| | | //编辑权限 |
| | | if (!DBUtility.ClsPub.Security_Log("Sc_MouldScrapOutBill_Edit", 1, false, msg4)) |
| | | if (!DBUtility.ClsPub.Security_Log("Sc_MouldScrapOutBill_Edit", 1, false, HMaker)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "无保存权限!"; |
| | | objJsonResult.Message = "您没有该模块新增/编辑权限,请与管理员联系!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | //表头赋值 |
| | | sMainStr = sMainStr.Replace("\\", ""); |
| | | sMainStr = sMainStr.Replace("\n", ""); |
| | | sMainStr = "[" + sMainStr.ToString() + "]"; |
| | | List<Model.ClsSc_MouldStockBillMain> lsmain = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsSc_MouldStockBillMain>>(sMainStr); |
| | | foreach (Model.ClsSc_MouldStockBillMain oItem in lsmain) |
| | | { |
| | | if (oItem.HInterID == 0) |
| | | { |
| | | BillStatus = DBUtility.ClsPub.Enum_BillStatus.BillStatus_AddNew; |
| | | } |
| | | else |
| | | { |
| | | BillStatus = DBUtility.ClsPub.Enum_BillStatus.BillStatus_Modify; |
| | | } |
| | | //单据号是否重复 |
| | | if (oBill.IsExistBillNo(ref ClsPub.sExeReturnInfo, oItem.HBillNo, BillStatus, oItem.HInterID)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据号重复!不允许保存!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | //判断会计期是否合理 |
| | | string s = ""; |
| | | int sYear = 0; |
| | | int sPeriod = 0; |
| | | if (DBUtility.Xt_BaseBillFun.Fun_AllowYearPeriod(oItem.HDate, ref sYear, ref sPeriod, ref s) == false) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = s; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | oItem.HYear = sYear; |
| | | oItem.HPeriod = sPeriod; |
| | | DBUtility.ClsPub.CurUserName = oItem.HMaker; |
| | | oBill.omodel = oItem; |
| | | } |
| | | //表体赋值 |
| | | //按 },{来拆分数组 //去掉【和】 |
| | | sSubStr = sSubStr.Substring(1, sSubStr.Length - 2); |
| | | sSubStr = sSubStr.Replace("\\", ""); |
| | | sSubStr = sSubStr.Replace("\n", ""); |
| | | sSubStr = "[" + sSubStr.ToString() + "]"; |
| | | List<Model.ClsSc_MouldStockBillSub> ls = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsSc_MouldStockBillSub>>(sSubStr); |
| | | int i = 0; |
| | | foreach (Model.ClsSc_MouldStockBillSub oItemSub in ls) |
| | | { |
| | | i++; |
| | | oItemSub.HEntryID = i; |
| | | oBill.DetailColl.Add(oItemSub); |
| | | } |
| | | |
| | | string sErrMsg = ""; |
| | | bool bResult; |
| | | //获取系统参数 |
| | | if (oSystemParameter.ShowBill(ref sErrMsg) == true) |
| | | { |
| | | //保存 |
| | | if (oBill.omodel.HInterID == 0) //新增保存 |
| | | { |
| | | bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); |
| | | |
| | | if (oSystemParameter.omodel.WMS_CampanyName == "四维尔") //系统参数 客户定制化名称 空白为通用 |
| | | { |
| | | //修改器具档案位置 |
| | | string sql = string.Format($"exec h_p_Sc_MouldChangeFileStatus 'out','{oBill.omodel.HInterID.ToString()}' "); |
| | | oCn.RunProc(sql); |
| | | } |
| | | } |
| | | else //编辑保存 |
| | | { |
| | | bResult = oBill.ModifyBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo); |
| | | |
| | | if (oSystemParameter.omodel.WMS_CampanyName == "四维尔") //系统参数 客户定制化名称 空白为通用 |
| | | { |
| | | //修改器具档案位置 |
| | | string sql = string.Format($"exec h_p_Sc_MouldChangeNowWHID "); |
| | | oCn.RunProc(sql); |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "获取系统参数失败! " + sErrMsg; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | DLL.ClsSc_MouldScrapOutBill oBill = new DLL.ClsSc_MouldScrapOutBill(); |
| | | List<Model.ClsSc_MouldStockBillMain> lsmain = new List<Model.ClsSc_MouldStockBillMain>(); |
| | | msg2 = msg2.Replace("\\", ""); |
| | | msg2 = msg2.Replace("\n", ""); //\n |
| | | lsmain = oListModels.getObjectByJson_Gy_MouldScrapOutHouseBillMain(msg2); |
| | | foreach (Model.ClsSc_MouldStockBillMain oItem in lsmain) |
| | | { |
| | | //oItem.HMaker = ""; |
| | | UserName = oItem.HMaker; //制单人 |
| | | oItem.HBillType = "3832"; |
| | | oItem.HBillSubType = "3832"; |
| | | //oItem.HBillNo = ""; //单据号 |
| | | //oItem.HDate = DBUtility.ClsPub.isDate(DateTime.Now.ToString("yyyy-MM-dd"));// --日期 |
| | | //oItem.HInnerBillNo = ""; // --内部单据号 |
| | | oItem.HYear = DBUtility.ClsPub.isLong(DateTime.Now.Year); |
| | | oItem.HMakeDate = DBUtility.ClsPub.isStrNull(DateTime.Now.ToString("yyyy-MM-dd")); |
| | | //oItem.HEquipID = 0; //设备ID(Gy_EquipMent) |
| | | //oItem.HPeriod = 0; |
| | | //oItem.HCheckBeginDate = DBUtility.ClsPub.isDate(DateTime.Now.ToString("yyyy-MM-dd")); // --维修日期 |
| | | //oItem.HCheckResult = ""; //验收结论--(正常,异常) |
| | | //oItem.HEmpID = 0; //验收人(Gy_Employee) |
| | | //oItem.HManagerID = 0; //负责人(Gy_Employee) |
| | | //oItem.HDeptID = 0; //验收部门(Gy_Department) |
| | | //oItem.HExplanation = ""; //摘要(故障描述) |
| | | //oItem.HRemark = ""; //备注 |
| | | |
| | | //oItem.HMainSourceInterID = oItem.HInterID; |
| | | |
| | | //oItem.HInterID = DBUtility.ClsPub.CreateBillID_SRMProd("1103", ref DBUtility.ClsPub.sExeReturnInfo); |
| | | if (DBUtility.ClsPub.isStrNull(oItem.HDate) == "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "保存失败!没有单据日期,无法保存!"; |
| | | objJsonResult.data = 1; |
| | | return objJsonResult; |
| | | } |
| | | oBill.omodel = oItem; |
| | | } |
| | | //表体数据 |
| | | //按 },{来拆分数组 //去掉【和】 |
| | | msg3 = msg3.Substring(1, msg3.Length - 2); |
| | | msg3 = msg3.Replace("\\", ""); |
| | | msg3 = msg3.Replace("\n", ""); //\n |
| | | //msg2 = msg2.Replace("'", "’"); |
| | | List<Model.ClsSc_MouldStockBillSub> ls = new List<Model.ClsSc_MouldStockBillSub>(); |
| | | ls = oListModels.getObjectByJson_Gy_MouldScrapOutHouseBillSub(msg3); |
| | | int i = 0; |
| | | foreach (Model.ClsSc_MouldStockBillSub oItemSub in ls) |
| | | { |
| | | |
| | | i++; |
| | | oItemSub.HEntryID = i; |
| | | |
| | | //oItemSub.HRepairCheckID = 0; //验收项目ID |
| | | //oItemSub.HRepairCheckContent = ""; //验收内容 |
| | | //oItemSub.HManagerID = 0; //负责人ID |
| | | //oItemSub.HCloseMan = ""; //行关闭 |
| | | oItemSub.HEntryCloseDate = DBUtility.ClsPub.isDate(DateTime.Now); |
| | | oItemSub.HCloseType = false; //关闭类型 |
| | | //oItemSub.HRemark = ""; //备注 |
| | | oItemSub.HSourceInterID = 0; // 源单主内码 |
| | | oItemSub.HSourceEntryID = 0; //源单子内码 |
| | | //oItemSub.HSourceBillNo = ""; //源单单号 |
| | | //oItemSub.HSourceBillType = ""; //源单类型 |
| | | //oItemSub.HRelationQty = 0; //关联数量 |
| | | //oItemSub.HRelationMoney = 0; //关联金额 |
| | | //oItemSub.HRepairID = 0; //维修项目 |
| | | //oItemSub.HRepairExplanation =""; //维修要求 |
| | | //oItemSub.HMoney = 0; //维修费用 |
| | | oBill.DetailColl.Add(oItemSub); |
| | | |
| | | } |
| | | //保存 |
| | | //保存完毕后处理 |
| | | bool bResult; |
| | | if (oBill.omodel.HInterID == 0) |
| | | { |
| | | // bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); |
| | | bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); |
| | | string sql = string.Format($"exec h_p_Sc_MouldChangeFileStatus 'out','{oBill.omodel.HInterID.ToString()}' "); |
| | | oCn.RunProc(sql); |
| | | } |
| | | else |
| | | { |
| | | bResult = oBill.ModifyBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo); |
| | | //修改成功 |
| | | //string sql = string.Format($"exec h_p_Sc_MouldChangeNowWHID 1,{oBill.omodel.HInterID.ToString()},' ' "); |
| | | string sql = string.Format($"exec h_p_Sc_MouldChangeNowWHID "); |
| | | oCn.RunProc(sql); |
| | | } |
| | | if (bResult) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "保存成功!"; |
| | | //WebAPIController.Add_Log("送货单下推", UserName, "生成送货单"); |
| | | objJsonResult.data = 1; |
| | | objJsonResult.Message = DBUtility.ClsPub.sExeReturnInfo; //成功! |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | else |
| | |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "保存失败!" + DBUtility.ClsPub.sExeReturnInfo; |
| | | objJsonResult.data = 1; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "保存失败!" + e.ToString(); |
| | | objJsonResult.data = 1; |
| | | objJsonResult.Message = "保存失败!" + e.Message; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | |
| | | } |
| | | #endregion |
| | | |
| | | #region 模具退库单保存/编辑 |
| | | #region 模具退库单保存/编辑 20240702作废 |
| | | /// <summary> |
| | | /// 保存模具退库单 |
| | | /// </summary> |
| | | /// <param name="msg"></param> |
| | | /// <returns></returns> |
| | | //[Route("Sc_MouldProdBackBill/SaveGetMouldProdBackBillList")] |
| | | //[HttpPost] |
| | | //public object SaveGetMouldProdBackBillList([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 msg4 = sArray[2].ToString(); |
| | | |
| | | // string UserName = ""; |
| | | // ListModels oListModels = new ListModels(); |
| | | // try |
| | | // { |
| | | // if (!DBUtility.ClsPub.Security_Log("Sc_MouldProdBackBill_Edit", 1, false, msg4)) |
| | | // { |
| | | // objJsonResult.code = "0"; |
| | | // objJsonResult.count = 0; |
| | | // objJsonResult.Message = "没有保存权限"; |
| | | // objJsonResult.data = null; |
| | | // return objJsonResult; |
| | | // } |
| | | |
| | | // DLL.ClsSc_MouldProdBackBill oBill = new DLL.ClsSc_MouldProdBackBill(); |
| | | // List<Model.ClsSc_MouldProdBackBillMain> lsmain = new List<Model.ClsSc_MouldProdBackBillMain>(); |
| | | // msg2 = msg2.Replace("\\", ""); |
| | | // msg2 = msg2.Replace("\n", ""); //\n |
| | | // lsmain = oListModels.getObjectByJson_Gy_MouldProdBackBillMain(msg2); |
| | | // foreach (Model.ClsSc_MouldProdBackBillMain oItem in lsmain) |
| | | // { |
| | | // //oItem.HMaker = ""; |
| | | // UserName = oItem.HMaker; //制单人 |
| | | // oItem.HBillType = "3803"; |
| | | // oItem.HBillSubType = "3803"; |
| | | // //oItem.HBillNo = ""; //单据号 |
| | | // //oItem.HDate = DBUtility.ClsPub.isDate(DateTime.Now.ToString("yyyy-MM-dd"));// --日期 |
| | | // //oItem.HInnerBillNo = ""; // --内部单据号 |
| | | // oItem.HYear = DBUtility.ClsPub.isLong(DateTime.Now.Year); |
| | | // oItem.HMakeDate = DBUtility.ClsPub.isStrNull(DateTime.Now.ToString("yyyy-MM-dd")); |
| | | // //oItem.HEquipID = 0; //设备ID(Gy_EquipMent) |
| | | // //oItem.HPeriod = 0; |
| | | // //oItem.HCheckBeginDate = DBUtility.ClsPub.isDate(DateTime.Now.ToString("yyyy-MM-dd")); // --维修日期 |
| | | // //oItem.HCheckResult = ""; //验收结论--(正常,异常) |
| | | // //oItem.HEmpID = 0; //验收人(Gy_Employee) |
| | | // //oItem.HManagerID = 0; //负责人(Gy_Employee) |
| | | // //oItem.HDeptID = 0; //验收部门(Gy_Department) |
| | | // //oItem.HExplanation = ""; //摘要(故障描述) |
| | | // //oItem.HRemark = ""; //备注 |
| | | |
| | | // //oItem.HMainSourceInterID = oItem.HInterID; |
| | | |
| | | // //oItem.HInterID = DBUtility.ClsPub.CreateBillID_SRMProd("1103", ref DBUtility.ClsPub.sExeReturnInfo); |
| | | // if (DBUtility.ClsPub.isStrNull(oItem.HDate) == "") |
| | | // { |
| | | // objJsonResult.code = "0"; |
| | | // objJsonResult.count = 0; |
| | | // objJsonResult.Message = "保存失败!没有单据日期,无法保存!"; |
| | | // objJsonResult.data = 1; |
| | | // return objJsonResult; |
| | | // } |
| | | // oBill.omodel = oItem; |
| | | // } |
| | | // //表体数据 |
| | | // //按 },{来拆分数组 //去掉【和】 |
| | | // msg3 = msg3.Substring(1, msg3.Length - 2); |
| | | // msg3 = msg3.Replace("\\", ""); |
| | | // msg3 = msg3.Replace("\n", ""); //\n |
| | | // //msg2 = msg2.Replace("'", "’"); |
| | | // List<Model.ClsSc_MouldProdBackBillSub> ls = new List<Model.ClsSc_MouldProdBackBillSub>(); |
| | | // ls = oListModels.getObjectByJson_Gy_MouldProdBackBillSub(msg3); |
| | | // int i = 0; |
| | | // foreach (Model.ClsSc_MouldProdBackBillSub oItemSub in ls) |
| | | // { |
| | | |
| | | // i++; |
| | | // oItemSub.HEntryID = i; |
| | | |
| | | // //oItemSub.HRepairCheckID = 0; //验收项目ID |
| | | // //oItemSub.HRepairCheckContent = ""; //验收内容 |
| | | // //oItemSub.HManagerID = 0; //负责人ID |
| | | // //oItemSub.HCloseMan = ""; //行关闭 |
| | | // oItemSub.HEntryCloseDate = DBUtility.ClsPub.isDate(DateTime.Now); |
| | | // oItemSub.HCloseType = false; //关闭类型 |
| | | // //oItemSub.HRemark = ""; //备注 |
| | | // oItemSub.HSourceInterID = 0; // 源单主内码 |
| | | // oItemSub.HSourceEntryID = 0; //源单子内码 |
| | | // //oItemSub.HSourceBillNo = ""; //源单单号 |
| | | // //oItemSub.HSourceBillType = ""; //源单类型 |
| | | // //oItemSub.HRelationQty = 0; //关联数量 |
| | | // //oItemSub.HRelationMoney = 0; //关联金额 |
| | | // //oItemSub.HRepairID = 0; //维修项目 |
| | | // //oItemSub.HRepairExplanation =""; //维修要求 |
| | | // //oItemSub.HMoney = 0; //维修费用 |
| | | // oBill.DetailColl.Add(oItemSub); |
| | | |
| | | // } |
| | | // //保存 |
| | | // //保存完毕后处理 |
| | | // bool bResult; |
| | | // if (oBill.omodel.HInterID == 0) |
| | | // { |
| | | // // bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); |
| | | // bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); |
| | | // string sql1 = string.Format($"exec h_p_Sc_MouldChangeFileStatus 'in','{oBill.omodel.HInterID.ToString()}' "); |
| | | // oCn.RunProc(sql1); |
| | | // } |
| | | // else |
| | | // { |
| | | // bResult = oBill.ModifyBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo); |
| | | // //修改成功 |
| | | // //string sql = string.Format($"exec h_p_Sc_MouldChangeNowWHID 1,{oBill.omodel.HInterID.ToString()},' ' "); |
| | | // string sql = string.Format($"exec h_p_Sc_MouldChangeNowWHID "); |
| | | // oCn.RunProc(sql); |
| | | // } |
| | | // if (bResult) |
| | | // { |
| | | // string sql =string.Format($"exec h_p_Sc_MouldProdBackBillList '{oBill.omodel.HBillNo}' ") ; |
| | | // oCn.RunProc(sql); |
| | | // 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; |
| | | // } |
| | | //} |
| | | #endregion |
| | | |
| | | #region 模具退库单保存/编辑 20240702 |
| | | /// <summary> |
| | | /// 保存模具退库单 |
| | | /// </summary> |
| | |
| | | [HttpPost] |
| | | public object SaveGetMouldProdBackBillList([FromBody] JObject msg) |
| | | { |
| | | DAL.ClsSc_MouldProdBackBill oBill = new DAL.ClsSc_MouldProdBackBill(); |
| | | |
| | | 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 msg4 = sArray[2].ToString(); |
| | | |
| | | string UserName = ""; |
| | | ListModels oListModels = new ListModels(); |
| | | string sMainStr = sArray[0].ToString(); //主表数据 |
| | | string sSubStr = sArray[1].ToString(); //子表数据 |
| | | string HMaker = sArray[2].ToString(); //制单人 |
| | | try |
| | | { |
| | | if (!DBUtility.ClsPub.Security_Log("Sc_MouldProdBackBill_Edit", 1, false, msg4)) |
| | | //判断权限 |
| | | if (!DBUtility.ClsPub.Security_Log("Sc_MouldProdBackBill_Edit", 1, false, HMaker)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "没有保存权限"; |
| | | objJsonResult.Message = "您没有该模块新增/编辑权限,请与管理员联系!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | //表头赋值 |
| | | sMainStr = sMainStr.Replace("\\", ""); |
| | | sMainStr = sMainStr.Replace("\n", ""); |
| | | sMainStr = "[" + sMainStr.ToString() + "]"; |
| | | List<Model.ClsSc_MouldProdBackBillMain> lsmain = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsSc_MouldProdBackBillMain>>(sMainStr); |
| | | foreach (Model.ClsSc_MouldProdBackBillMain oItem in lsmain) |
| | | { |
| | | if (oItem.HInterID == 0) |
| | | { |
| | | BillStatus = DBUtility.ClsPub.Enum_BillStatus.BillStatus_AddNew; |
| | | } |
| | | else |
| | | { |
| | | BillStatus = DBUtility.ClsPub.Enum_BillStatus.BillStatus_Modify; |
| | | } |
| | | //单据号是否重复 |
| | | if (oBill.IsExistBillNo(ref ClsPub.sExeReturnInfo, oItem.HBillNo, BillStatus, oItem.HInterID)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据号重复!不允许保存!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | //判断会计期是否合理 |
| | | string s = ""; |
| | | int sYear = 0; |
| | | int sPeriod = 0; |
| | | if (DBUtility.Xt_BaseBillFun.Fun_AllowYearPeriod(oItem.HDate, ref sYear, ref sPeriod, ref s) == false) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = s; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | oItem.HYear = sYear; |
| | | oItem.HPeriod = sPeriod; |
| | | DBUtility.ClsPub.CurUserName = oItem.HMaker; |
| | | oBill.omodel = oItem; |
| | | } |
| | | //表体赋值 |
| | | //按 },{来拆分数组 //去掉【和】 |
| | | sSubStr = sSubStr.Substring(1, sSubStr.Length - 2); |
| | | sSubStr = sSubStr.Replace("\\", ""); |
| | | sSubStr = sSubStr.Replace("\n", ""); |
| | | sSubStr = "[" + sSubStr.ToString() + "]"; |
| | | List<Model.ClsSc_MouldStockBillSub> ls = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsSc_MouldStockBillSub>>(sSubStr); |
| | | int i = 0; |
| | | foreach (Model.ClsSc_MouldStockBillSub oItemSub in ls) |
| | | { |
| | | i++; |
| | | oItemSub.HEntryID = i; |
| | | oBill.DetailColl.Add(oItemSub); |
| | | } |
| | | |
| | | string sErrMsg = ""; |
| | | bool bResult; |
| | | //获取系统参数 |
| | | if (oSystemParameter.ShowBill(ref sErrMsg) == true) |
| | | { |
| | | //保存 |
| | | if (oBill.omodel.HInterID == 0) //新增保存 |
| | | { |
| | | bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); |
| | | |
| | | if (oSystemParameter.omodel.WMS_CampanyName == "四维尔") //系统参数 客户定制化名称 空白为通用 |
| | | { |
| | | //修改器具档案位置 |
| | | string sql1 = string.Format($"exec h_p_Sc_MouldChangeFileStatus 'in','{oBill.omodel.HInterID.ToString()}' "); |
| | | oCn.RunProc(sql1); |
| | | } |
| | | } |
| | | else //编辑保存 |
| | | { |
| | | bResult = oBill.ModifyBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo); |
| | | |
| | | if (oSystemParameter.omodel.WMS_CampanyName == "四维尔") //系统参数 客户定制化名称 空白为通用 |
| | | { |
| | | //修改器具档案位置 |
| | | string sql = string.Format($"exec h_p_Sc_MouldChangeNowWHID "); |
| | | oCn.RunProc(sql); |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "获取系统参数失败! " + sErrMsg; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | DLL.ClsSc_MouldProdBackBill oBill = new DLL.ClsSc_MouldProdBackBill(); |
| | | List<Model.ClsSc_MouldProdBackBillMain> lsmain = new List<Model.ClsSc_MouldProdBackBillMain>(); |
| | | msg2 = msg2.Replace("\\", ""); |
| | | msg2 = msg2.Replace("\n", ""); //\n |
| | | lsmain = oListModels.getObjectByJson_Gy_MouldProdBackBillMain(msg2); |
| | | foreach (Model.ClsSc_MouldProdBackBillMain oItem in lsmain) |
| | | { |
| | | //oItem.HMaker = ""; |
| | | UserName = oItem.HMaker; //制单人 |
| | | oItem.HBillType = "3803"; |
| | | oItem.HBillSubType = "3803"; |
| | | //oItem.HBillNo = ""; //单据号 |
| | | //oItem.HDate = DBUtility.ClsPub.isDate(DateTime.Now.ToString("yyyy-MM-dd"));// --日期 |
| | | //oItem.HInnerBillNo = ""; // --内部单据号 |
| | | oItem.HYear = DBUtility.ClsPub.isLong(DateTime.Now.Year); |
| | | oItem.HMakeDate = DBUtility.ClsPub.isStrNull(DateTime.Now.ToString("yyyy-MM-dd")); |
| | | //oItem.HEquipID = 0; //设备ID(Gy_EquipMent) |
| | | //oItem.HPeriod = 0; |
| | | //oItem.HCheckBeginDate = DBUtility.ClsPub.isDate(DateTime.Now.ToString("yyyy-MM-dd")); // --维修日期 |
| | | //oItem.HCheckResult = ""; //验收结论--(正常,异常) |
| | | //oItem.HEmpID = 0; //验收人(Gy_Employee) |
| | | //oItem.HManagerID = 0; //负责人(Gy_Employee) |
| | | //oItem.HDeptID = 0; //验收部门(Gy_Department) |
| | | //oItem.HExplanation = ""; //摘要(故障描述) |
| | | //oItem.HRemark = ""; //备注 |
| | | |
| | | //oItem.HMainSourceInterID = oItem.HInterID; |
| | | |
| | | //oItem.HInterID = DBUtility.ClsPub.CreateBillID_SRMProd("1103", ref DBUtility.ClsPub.sExeReturnInfo); |
| | | if (DBUtility.ClsPub.isStrNull(oItem.HDate) == "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "保存失败!没有单据日期,无法保存!"; |
| | | objJsonResult.data = 1; |
| | | return objJsonResult; |
| | | } |
| | | oBill.omodel = oItem; |
| | | } |
| | | //表体数据 |
| | | //按 },{来拆分数组 //去掉【和】 |
| | | msg3 = msg3.Substring(1, msg3.Length - 2); |
| | | msg3 = msg3.Replace("\\", ""); |
| | | msg3 = msg3.Replace("\n", ""); //\n |
| | | //msg2 = msg2.Replace("'", "’"); |
| | | List<Model.ClsSc_MouldProdBackBillSub> ls = new List<Model.ClsSc_MouldProdBackBillSub>(); |
| | | ls = oListModels.getObjectByJson_Gy_MouldProdBackBillSub(msg3); |
| | | int i = 0; |
| | | foreach (Model.ClsSc_MouldProdBackBillSub oItemSub in ls) |
| | | { |
| | | |
| | | i++; |
| | | oItemSub.HEntryID = i; |
| | | |
| | | //oItemSub.HRepairCheckID = 0; //验收项目ID |
| | | //oItemSub.HRepairCheckContent = ""; //验收内容 |
| | | //oItemSub.HManagerID = 0; //负责人ID |
| | | //oItemSub.HCloseMan = ""; //行关闭 |
| | | oItemSub.HEntryCloseDate = DBUtility.ClsPub.isDate(DateTime.Now); |
| | | oItemSub.HCloseType = false; //关闭类型 |
| | | //oItemSub.HRemark = ""; //备注 |
| | | oItemSub.HSourceInterID = 0; // 源单主内码 |
| | | oItemSub.HSourceEntryID = 0; //源单子内码 |
| | | //oItemSub.HSourceBillNo = ""; //源单单号 |
| | | //oItemSub.HSourceBillType = ""; //源单类型 |
| | | //oItemSub.HRelationQty = 0; //关联数量 |
| | | //oItemSub.HRelationMoney = 0; //关联金额 |
| | | //oItemSub.HRepairID = 0; //维修项目 |
| | | //oItemSub.HRepairExplanation =""; //维修要求 |
| | | //oItemSub.HMoney = 0; //维修费用 |
| | | oBill.DetailColl.Add(oItemSub); |
| | | |
| | | } |
| | | //保存 |
| | | //保存完毕后处理 |
| | | bool bResult; |
| | | if (oBill.omodel.HInterID == 0) |
| | | { |
| | | // bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); |
| | | bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); |
| | | string sql1 = string.Format($"exec h_p_Sc_MouldChangeFileStatus 'in','{oBill.omodel.HInterID.ToString()}' "); |
| | | oCn.RunProc(sql1); |
| | | } |
| | | else |
| | | { |
| | | bResult = oBill.ModifyBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo); |
| | | //修改成功 |
| | | //string sql = string.Format($"exec h_p_Sc_MouldChangeNowWHID 1,{oBill.omodel.HInterID.ToString()},' ' "); |
| | | string sql = string.Format($"exec h_p_Sc_MouldChangeNowWHID "); |
| | | oCn.RunProc(sql); |
| | | } |
| | | if (bResult) |
| | | { |
| | | string sql =string.Format($"exec h_p_Sc_MouldProdBackBillList '{oBill.omodel.HBillNo}' ") ; |
| | | oCn.RunProc(sql); |
| | | string sql = string.Format($"exec h_p_Sc_MouldProdBackBillList '{oBill.omodel.HBillNo}' "); |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "保存成功!"; |
| | | //WebAPIController.Add_Log("送货单下推", UserName, "生成送货单"); |
| | | objJsonResult.data = 1; |
| | | objJsonResult.Message = DBUtility.ClsPub.sExeReturnInfo; //成功! |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | else |
| | |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "保存失败!" + DBUtility.ClsPub.sExeReturnInfo; |
| | | objJsonResult.data = 1; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "保存失败!" + e.ToString(); |
| | | objJsonResult.data = 1; |
| | | objJsonResult.Message = "保存失败!" + e.Message; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | |
| | | } |
| | | #endregion |
| | | |
| | | #region 模具领用单保存/编辑 |
| | | #region 模具领用单保存/编辑 20240702作废 |
| | | /// <summary> |
| | | /// 保存模具领用单 |
| | | /// </summary> |
| | | /// <param name="msg"></param> |
| | | /// <returns></returns> |
| | | //[Route("Sc_MouldProdOutBill/SaveGetMouldProdOutBillList")] |
| | | //[HttpPost] |
| | | //public object SaveGetMouldProdOutBillList([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 msg4 = sArray[2].ToString(); |
| | | |
| | | |
| | | // string UserName = ""; |
| | | // ListModels oListModels = new ListModels(); |
| | | // try |
| | | // { |
| | | // //模块名,写入日志,报错框,用户名 |
| | | // if (!DBUtility.ClsPub.Security_Log("Sc_MouldProdOutBill_Edit", 1, false, msg4)) |
| | | // { |
| | | // objJsonResult.code = "0"; |
| | | // objJsonResult.count = 0; |
| | | // objJsonResult.Message = "没有保存权限"; |
| | | // objJsonResult.data = null; |
| | | // return objJsonResult; |
| | | // } |
| | | // DLL.ClsSc_MouldProdOutBill oBill = new DLL.ClsSc_MouldProdOutBill(); |
| | | // List<Model.ClsSc_MouldProdOutBillMain> lsmain = new List<Model.ClsSc_MouldProdOutBillMain>(); |
| | | // msg2 = msg2.Replace("\\", ""); |
| | | // msg2 = msg2.Replace("\n", ""); //\n |
| | | // lsmain = oListModels.getObjectByJson_Gy_MouldProdOutBillMain(msg2); |
| | | // foreach (Model.ClsSc_MouldProdOutBillMain oItem in lsmain) |
| | | // { |
| | | // //oItem.HMaker = ""; |
| | | // UserName = oItem.HMaker; //制单人 |
| | | // oItem.HBillType = "3802"; |
| | | // oItem.HBillSubType = "3802"; |
| | | // //oItem.HBillNo = ""; //单据号 |
| | | // //oItem.HDate = DBUtility.ClsPub.isDate(DateTime.Now.ToString("yyyy-MM-dd"));// --日期 |
| | | // //oItem.HInnerBillNo = ""; // --内部单据号 |
| | | // oItem.HYear = DBUtility.ClsPub.isLong(DateTime.Now.Year); |
| | | // oItem.HMakeDate = DBUtility.ClsPub.isStrNull(DateTime.Now.ToString("yyyy-MM-dd")); |
| | | // //oItem.HEquipID = 0; //设备ID(Gy_EquipMent) |
| | | // //oItem.HPeriod = 0; |
| | | // //oItem.HCheckBeginDate = DBUtility.ClsPub.isDate(DateTime.Now.ToString("yyyy-MM-dd")); // --维修日期 |
| | | // //oItem.HCheckResult = ""; //验收结论--(正常,异常) |
| | | // //oItem.HEmpID = 0; //验收人(Gy_Employee) |
| | | // //oItem.HManagerID = 0; //负责人(Gy_Employee) |
| | | // //oItem.HDeptID = 0; //验收部门(Gy_Department) |
| | | // //oItem.HExplanation = ""; //摘要(故障描述) |
| | | // //oItem.HRemark = ""; //备注 |
| | | |
| | | // //oItem.HMainSourceInterID = oItem.HInterID; |
| | | |
| | | // //oItem.HInterID = DBUtility.ClsPub.CreateBillID_SRMProd("1103", ref DBUtility.ClsPub.sExeReturnInfo); |
| | | // if (DBUtility.ClsPub.isStrNull(oItem.HDate) == "") |
| | | // { |
| | | // objJsonResult.code = "0"; |
| | | // objJsonResult.count = 0; |
| | | // objJsonResult.Message = "保存失败!没有单据日期,无法保存!"; |
| | | // objJsonResult.data = 1; |
| | | // return objJsonResult; |
| | | // } |
| | | // oBill.omodel = oItem; |
| | | // } |
| | | // //表体数据 |
| | | // //按 },{来拆分数组 //去掉【和】 |
| | | // msg3 = msg3.Substring(1, msg3.Length - 2); |
| | | // msg3 = msg3.Replace("\\", ""); |
| | | // msg3 = msg3.Replace("\n", ""); //\n |
| | | // //msg2 = msg2.Replace("'", "’"); |
| | | // List<Model.ClsSc_MouldStockBillSub> ls = new List<Model.ClsSc_MouldStockBillSub>(); |
| | | // ls = oListModels.getObjectByJson_Gy_MouldStockBillSub(msg3); |
| | | // int i = 0; |
| | | // foreach (Model.ClsSc_MouldStockBillSub oItemSub in ls) |
| | | // { |
| | | |
| | | // i++; |
| | | // oItemSub.HEntryID = i; |
| | | |
| | | // //oItemSub.HRepairCheckID = 0; //验收项目ID |
| | | // //oItemSub.HRepairCheckContent = ""; //验收内容 |
| | | // //oItemSub.HManagerID = 0; //负责人ID |
| | | // //oItemSub.HCloseMan = ""; //行关闭 |
| | | // oItemSub.HEntryCloseDate = DBUtility.ClsPub.isDate(DateTime.Now); |
| | | // oItemSub.HCloseType = false; //关闭类型 |
| | | // //oItemSub.HRemark = ""; //备注 |
| | | // oItemSub.HSourceInterID = 0; // 源单主内码 |
| | | // oItemSub.HSourceEntryID = 0; //源单子内码 |
| | | // //oItemSub.HSourceBillNo = ""; //源单单号 |
| | | // //oItemSub.HSourceBillType = ""; //源单类型 |
| | | // //oItemSub.HRelationQty = 0; //关联数量 |
| | | // //oItemSub.HRelationMoney = 0; //关联金额 |
| | | // //oItemSub.HRepairID = 0; //维修项目 |
| | | // //oItemSub.HRepairExplanation =""; //维修要求 |
| | | // //oItemSub.HMoney = 0; //维修费用 |
| | | // oBill.DetailColl.Add(oItemSub); |
| | | |
| | | // } |
| | | // //保存 |
| | | // //保存完毕后处理 |
| | | // bool bResult; |
| | | // if (oBill.omodel.HInterID == 0) |
| | | // { |
| | | // // bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); |
| | | // bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); |
| | | // string sql = string.Format($"exec h_p_Sc_MouldChangeFileStatus 'out','{oBill.omodel.HInterID.ToString()}' "); |
| | | // oCn.RunProc(sql); |
| | | // } |
| | | // else |
| | | // { |
| | | // bResult = oBill.ModifyBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo); |
| | | // //修改成功 |
| | | // //string sql = string.Format($"exec h_p_Sc_MouldChangeNowWHID 1,{oBill.omodel.HInterID.ToString()},' ' "); |
| | | // string sql = string.Format($"exec h_p_Sc_MouldChangeNowWHID "); |
| | | // oCn.RunProc(sql); |
| | | // } |
| | | // 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; |
| | | // } |
| | | //} |
| | | #endregion |
| | | |
| | | #region 模具领用单保存/编辑 20240702 |
| | | /// <summary> |
| | | /// 保存模具领用单 |
| | | /// </summary> |
| | |
| | | [HttpPost] |
| | | public object SaveGetMouldProdOutBillList([FromBody] JObject msg) |
| | | { |
| | | DAL.ClsSc_MouldProdOutBill oBill = new DAL.ClsSc_MouldProdOutBill(); |
| | | |
| | | 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 msg4 = sArray[2].ToString(); |
| | | |
| | | |
| | | string UserName = ""; |
| | | ListModels oListModels = new ListModels(); |
| | | string sMainStr = sArray[0].ToString(); //主表数据 |
| | | string sSubStr = sArray[1].ToString(); //子表数据 |
| | | string HMaker = sArray[2].ToString(); //制单人 |
| | | try |
| | | { |
| | | //模块名,写入日志,报错框,用户名 |
| | | if (!DBUtility.ClsPub.Security_Log("Sc_MouldProdOutBill_Edit", 1, false, msg4)) |
| | | if (!DBUtility.ClsPub.Security_Log("Sc_MouldProdOutBill_Edit", 1, false, HMaker)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "没有保存权限"; |
| | | objJsonResult.Message = "您没有该模块新增/编辑权限,请与管理员联系!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | DLL.ClsSc_MouldProdOutBill oBill = new DLL.ClsSc_MouldProdOutBill(); |
| | | List<Model.ClsSc_MouldProdOutBillMain> lsmain = new List<Model.ClsSc_MouldProdOutBillMain>(); |
| | | msg2 = msg2.Replace("\\", ""); |
| | | msg2 = msg2.Replace("\n", ""); //\n |
| | | lsmain = oListModels.getObjectByJson_Gy_MouldProdOutBillMain(msg2); |
| | | //表头赋值 |
| | | sMainStr = sMainStr.Replace("\\", ""); |
| | | sMainStr = sMainStr.Replace("\n", ""); |
| | | sMainStr = "[" + sMainStr.ToString() + "]"; |
| | | List<Model.ClsSc_MouldProdOutBillMain> lsmain = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsSc_MouldProdOutBillMain>>(sMainStr); |
| | | foreach (Model.ClsSc_MouldProdOutBillMain oItem in lsmain) |
| | | { |
| | | //oItem.HMaker = ""; |
| | | UserName = oItem.HMaker; //制单人 |
| | | oItem.HBillType = "3802"; |
| | | oItem.HBillSubType = "3802"; |
| | | //oItem.HBillNo = ""; //单据号 |
| | | //oItem.HDate = DBUtility.ClsPub.isDate(DateTime.Now.ToString("yyyy-MM-dd"));// --日期 |
| | | //oItem.HInnerBillNo = ""; // --内部单据号 |
| | | oItem.HYear = DBUtility.ClsPub.isLong(DateTime.Now.Year); |
| | | oItem.HMakeDate = DBUtility.ClsPub.isStrNull(DateTime.Now.ToString("yyyy-MM-dd")); |
| | | //oItem.HEquipID = 0; //设备ID(Gy_EquipMent) |
| | | //oItem.HPeriod = 0; |
| | | //oItem.HCheckBeginDate = DBUtility.ClsPub.isDate(DateTime.Now.ToString("yyyy-MM-dd")); // --维修日期 |
| | | //oItem.HCheckResult = ""; //验收结论--(正常,异常) |
| | | //oItem.HEmpID = 0; //验收人(Gy_Employee) |
| | | //oItem.HManagerID = 0; //负责人(Gy_Employee) |
| | | //oItem.HDeptID = 0; //验收部门(Gy_Department) |
| | | //oItem.HExplanation = ""; //摘要(故障描述) |
| | | //oItem.HRemark = ""; //备注 |
| | | |
| | | //oItem.HMainSourceInterID = oItem.HInterID; |
| | | |
| | | //oItem.HInterID = DBUtility.ClsPub.CreateBillID_SRMProd("1103", ref DBUtility.ClsPub.sExeReturnInfo); |
| | | if (DBUtility.ClsPub.isStrNull(oItem.HDate) == "") |
| | | if (oItem.HInterID == 0) |
| | | { |
| | | BillStatus = DBUtility.ClsPub.Enum_BillStatus.BillStatus_AddNew; |
| | | } |
| | | else |
| | | { |
| | | BillStatus = DBUtility.ClsPub.Enum_BillStatus.BillStatus_Modify; |
| | | } |
| | | //单据号是否重复 |
| | | if (oBill.IsExistBillNo(ref ClsPub.sExeReturnInfo, oItem.HBillNo, BillStatus, oItem.HInterID)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "保存失败!没有单据日期,无法保存!"; |
| | | objJsonResult.data = 1; |
| | | objJsonResult.Message = "单据号重复!不允许保存!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | //判断会计期是否合理 |
| | | string s = ""; |
| | | int sYear = 0; |
| | | int sPeriod = 0; |
| | | if (DBUtility.Xt_BaseBillFun.Fun_AllowYearPeriod(oItem.HDate, ref sYear, ref sPeriod, ref s) == false) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = s; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | oItem.HYear = sYear; |
| | | oItem.HPeriod = sPeriod; |
| | | DBUtility.ClsPub.CurUserName = oItem.HMaker; |
| | | oBill.omodel = oItem; |
| | | } |
| | | //表体数据 |
| | | //表体赋值 |
| | | //按 },{来拆分数组 //去掉【和】 |
| | | msg3 = msg3.Substring(1, msg3.Length - 2); |
| | | msg3 = msg3.Replace("\\", ""); |
| | | msg3 = msg3.Replace("\n", ""); //\n |
| | | //msg2 = msg2.Replace("'", "’"); |
| | | List<Model.ClsSc_MouldStockBillSub> ls = new List<Model.ClsSc_MouldStockBillSub>(); |
| | | ls = oListModels.getObjectByJson_Gy_MouldStockBillSub(msg3); |
| | | sSubStr = sSubStr.Substring(1, sSubStr.Length - 2); |
| | | sSubStr = sSubStr.Replace("\\", ""); |
| | | sSubStr = sSubStr.Replace("\n", ""); |
| | | sSubStr = "[" + sSubStr.ToString() + "]"; |
| | | List<Model.ClsSc_MouldStockBillSub> ls = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsSc_MouldStockBillSub>>(sSubStr); |
| | | int i = 0; |
| | | foreach (Model.ClsSc_MouldStockBillSub oItemSub in ls) |
| | | { |
| | | |
| | | i++; |
| | | oItemSub.HEntryID = i; |
| | | |
| | | //oItemSub.HRepairCheckID = 0; //验收项目ID |
| | | //oItemSub.HRepairCheckContent = ""; //验收内容 |
| | | //oItemSub.HManagerID = 0; //负责人ID |
| | | //oItemSub.HCloseMan = ""; //行关闭 |
| | | oItemSub.HEntryCloseDate = DBUtility.ClsPub.isDate(DateTime.Now); |
| | | oItemSub.HCloseType = false; //关闭类型 |
| | | //oItemSub.HRemark = ""; //备注 |
| | | oItemSub.HSourceInterID = 0; // 源单主内码 |
| | | oItemSub.HSourceEntryID = 0; //源单子内码 |
| | | //oItemSub.HSourceBillNo = ""; //源单单号 |
| | | //oItemSub.HSourceBillType = ""; //源单类型 |
| | | //oItemSub.HRelationQty = 0; //关联数量 |
| | | //oItemSub.HRelationMoney = 0; //关联金额 |
| | | //oItemSub.HRepairID = 0; //维修项目 |
| | | //oItemSub.HRepairExplanation =""; //维修要求 |
| | | //oItemSub.HMoney = 0; //维修费用 |
| | | oBill.DetailColl.Add(oItemSub); |
| | | |
| | | } |
| | | //保存 |
| | | //保存完毕后处理 |
| | | |
| | | string sErrMsg = ""; |
| | | bool bResult; |
| | | if (oBill.omodel.HInterID == 0) |
| | | //获取系统参数 |
| | | if (oSystemParameter.ShowBill(ref sErrMsg) == true) |
| | | { |
| | | // bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); |
| | | bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); |
| | | string sql = string.Format($"exec h_p_Sc_MouldChangeFileStatus 'out','{oBill.omodel.HInterID.ToString()}' "); |
| | | oCn.RunProc(sql); |
| | | //保存 |
| | | if (oBill.omodel.HInterID == 0) //新增保存 |
| | | { |
| | | bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); |
| | | |
| | | if (oSystemParameter.omodel.WMS_CampanyName == "四维尔") //系统参数 客户定制化名称 空白为通用 |
| | | { |
| | | //修改器具档案位置 |
| | | string sql = string.Format($"exec h_p_Sc_MouldChangeFileStatus 'out','{oBill.omodel.HInterID.ToString()}' "); |
| | | oCn.RunProc(sql); |
| | | } |
| | | } |
| | | else //编辑保存 |
| | | { |
| | | bResult = oBill.ModifyBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo); |
| | | |
| | | if (oSystemParameter.omodel.WMS_CampanyName == "四维尔") //系统参数 客户定制化名称 空白为通用 |
| | | { |
| | | //修改器具档案位置 |
| | | string sql = string.Format($"exec h_p_Sc_MouldChangeNowWHID "); |
| | | oCn.RunProc(sql); |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | bResult = oBill.ModifyBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo); |
| | | //修改成功 |
| | | //string sql = string.Format($"exec h_p_Sc_MouldChangeNowWHID 1,{oBill.omodel.HInterID.ToString()},' ' "); |
| | | string sql = string.Format($"exec h_p_Sc_MouldChangeNowWHID "); |
| | | oCn.RunProc(sql); |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "获取系统参数失败! " + sErrMsg; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | if (bResult) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "保存成功!"; |
| | | //WebAPIController.Add_Log("送货单下推", UserName, "生成送货单"); |
| | | objJsonResult.data = 1; |
| | | objJsonResult.Message = DBUtility.ClsPub.sExeReturnInfo; //成功! |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | else |
| | |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "保存失败!" + DBUtility.ClsPub.sExeReturnInfo; |
| | | objJsonResult.data = 1; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "保存失败!" + e.ToString(); |
| | | objJsonResult.data = 1; |
| | | objJsonResult.Message = "保存失败!" + e.Message; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | |
| | | } |
| | | #endregion |
| | | |
| | | #region [模具寿命调整单审核、反审核] |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | /// <param name="HInterID">单据ID</param> |
| | | /// <param name="IsAudit">审核(0),反审核(1)</param> |
| | | /// <param name="CurUserName">审核人</param> |
| | | /// <returns></returns> |
| | | [Route("Sc_MouldLifeChangeBill/AuditSc_MouldLifeChangeBillList")] |
| | | [HttpGet] |
| | | public object AuditSc_MouldLifeChangeBillList(int HInterID, int IsAudit, string CurUserName) |
| | | { |
| | | string ModRightNameCheck = "Sc_MouldLifeChangeBill_Check"; |
| | | DBUtility.ClsPub.CurUserName = CurUserName; |
| | | try |
| | | { |
| | | //审核权限 |
| | | if (!DBUtility.ClsPub.Security_Log(ModRightNameCheck, 1, false, CurUserName)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "审核失败!无权限!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | if (HInterID <= 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "HInterID小于0!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | Int64 lngBillKey = 0; |
| | | lngBillKey = DBUtility.ClsPub.isLong(HInterID); |
| | | DAL.ClsSc_MouldLifeChangeBill oBill = new DAL.ClsSc_MouldLifeChangeBill(); |
| | | //查看是否已审核,关闭,作废 |
| | | if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo)) |
| | | { |
| | | if (oBill.omodel.HCloseMan.Trim() != "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据已关闭!不能再次审核!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | if (oBill.omodel.HDeleteMan.Trim() != "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据已作废!不能再次审核!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | if (IsAudit == 0) //审核判断 |
| | | { |
| | | if (oBill.omodel.HChecker.Trim() != "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据已审核!不能再次审核!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | if (IsAudit == 1) //反审核判断 |
| | | { |
| | | if (oBill.omodel.HChecker.Trim() == "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据未审核!不需要反审核!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据不存在!原因:" + DBUtility.ClsPub.sExeReturnInfo; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | oCn.BeginTran();//开始事物 |
| | | |
| | | if (IsAudit == 0) //审核提交 |
| | | { |
| | | |
| | | //===============================Begin 审核前控制 Begin=============================== |
| | | string sql = "exec h_p_Sc_MouldLifeChangeBill_BeforeCheckCtrl " + HInterID + ",'" + CurUserName + "'"; |
| | | ds = oCn.RunProcReturn(sql, "h_p_Sc_MouldLifeChangeBill_BeforeCheckCtrl"); |
| | | if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0) |
| | | { |
| | | oCn.RollBack();//回滚事物 |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "审核失败!原因:审核前判断失败,请与网络管理人员联系"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | |
| | | } |
| | | if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0") |
| | | { |
| | | oCn.RollBack();//回滚事物 |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | //=================================End 审核前控制 End================================= |
| | | |
| | | //审核提交 |
| | | if (oBill.CheckBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo) == true) |
| | | { |
| | | |
| | | //===============================Begin 审核后控制 Begin=============================== |
| | | string sql2 = "exec h_p_Sc_MouldLifeChangeBill_AfterCheckCtrl " + HInterID + ",'" + CurUserName + "'"; |
| | | ds = oCn.RunProcReturn(sql2, "h_p_Sc_MouldLifeChangeBill_AfterCheckCtrl"); |
| | | if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0) |
| | | { |
| | | oCn.RollBack();//回滚事物 |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "审核失败!原因:审核后判断失败,请与网络管理人员联系"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | |
| | | } |
| | | if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0") |
| | | { |
| | | oCn.RollBack();//回滚事物 |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | //=================================End 审核后控制 End================================= |
| | | |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "审核成功"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | else |
| | | { |
| | | oCn.RollBack();//回滚事物 |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "审核失败!原因:" + DBUtility.ClsPub.sExeReturnInfo; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | if (IsAudit == 1) //反审核提交 |
| | | { |
| | | //===============================Begin 反审核前控制 Begin=============================== |
| | | string sql = "exec h_p_Sc_MouldLifeChangeBill_BeforeUnCheckCtrl " + HInterID + ",'" + CurUserName + "'"; |
| | | ds = oCn.RunProcReturn(sql, "h_p_Sc_MouldLifeChangeBill_BeforeUnCheckCtrl"); |
| | | if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0) |
| | | { |
| | | oCn.RollBack();//回滚事物 |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "审核失败!原因:反审核前判断失败,请与网络管理人员联系"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | |
| | | } |
| | | if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0") |
| | | { |
| | | oCn.RollBack();//回滚事物 |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | //=================================End 反审核前控制 End================================= |
| | | //反审核提交AbandonCheck |
| | | if (oBill.AbandonCheck(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo) == true) |
| | | { |
| | | //===============================Begin 反审核后控制 Begin=============================== |
| | | string sql2 = "exec h_p_Sc_MouldLifeChangeBill_AfterUnCheckCtrl " + HInterID + ",'" + CurUserName + "'"; |
| | | ds = oCn.RunProcReturn(sql2, "h_p_Sc_MouldLifeChangeBill_AfterUnCheckCtrl"); |
| | | if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0) |
| | | { |
| | | oCn.RollBack();//回滚事物 |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "审核失败!原因:反审核后判断失败,请与网络管理人员联系"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | |
| | | } |
| | | if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0") |
| | | { |
| | | oCn.RollBack();//回滚事物 |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | //=================================End 反审核后控制 End================================= |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "反审核成功"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | else |
| | | { |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "反审核失败!原因:" + DBUtility.ClsPub.sExeReturnInfo; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | |
| | | oCn.Commit();//提交事物 |
| | | return objJsonResult; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | oCn.RollBack();//回滚事物 |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "审核失败或者反审核失败!" + e.ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #endregion |
| | | |
| | | #region 器具保养计划单审核/反审核功能 |
| | | [Route("Sc_MouldMaintainPlanBill/CheckSc_MouldMaintainPlanBill")] |
| | | [HttpGet] |
| | | public object CheckSc_MouldMaintainPlanBill(string HInterID, int Type, string user) |
| | | { |
| | | DAL.ClsSc_MouldMaintainPlanBill BillOld = new DAL.ClsSc_MouldMaintainPlanBill(); |
| | | try |
| | | { |
| | | //判断是否有审核权限 |
| | | if (!DBUtility.ClsPub.Security_Log("Sc_MouldMaintainPlanBill_Check", 1, false, user)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "无权限审核!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | if (string.IsNullOrWhiteSpace(HInterID)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "HInterID为空!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | ClsPub.CurUserName = user; |
| | | oCN.BeginTran();//开始事务 |
| | | |
| | | //Type 1 审核 2 反审核 |
| | | if (Type == 1) |
| | | { |
| | | if (!BillOld.CheckBill(int.Parse(HInterID), ref ClsPub.sExeReturnInfo)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "审核失败!原因:" + ClsPub.sExeReturnInfo; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | //自动生成点检计划单 |
| | | oCN.RunProc("exec h_p_Sc_MouldMaintainPlan_Auto " + HInterID); |
| | | } |
| | | else |
| | | { |
| | | if (BillOld.AbandonCheck(int.Parse(HInterID), ref ClsPub.sExeReturnInfo)) |
| | | { |
| | | SQLHelper.ClsCN oCn = new SQLHelper.ClsCN(); |
| | | } |
| | | else |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "审核失败!原因:" + ClsPub.sExeReturnInfo; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | |
| | | oCN.Commit();//提交事务 |
| | | |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "执行成功!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; ; |
| | | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "执行失败!" + e.ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #region[器具保养计划表编辑时获取表体数据--保养计划] |
| | | [Route("Sc_MouldMaintainPlanBill/GetPlanList")] |
| | | [HttpGet] |
| | | public object GetPlanList(string sqlWhere) |
| | | { |
| | | DataSet ds; |
| | | try |
| | | { |
| | | SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); |
| | | if (sqlWhere == null || sqlWhere.Equals("")) |
| | | { |
| | | ds = oCN.RunProcReturn("select * from h_v_Sc_MouldMaintainPlanList", "h_v_Sc_MouldMaintainPlanList"); |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "获取信息成功!"; |
| | | objJsonResult.data = ds.Tables[0]; |
| | | } |
| | | else |
| | | { |
| | | string sql1 = "select * from h_v_Sc_MouldMaintainPlanList where 1 = 1 "; |
| | | string sql = sql1 + sqlWhere; |
| | | ds = oCN.RunProcReturn(sql, "h_v_Sc_MouldMaintainPlanList"); |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "获取信息成功!"; |
| | | objJsonResult.data = ds.Tables[0]; |
| | | } |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "没有返回任何计划!" + e.ToString(); |
| | | objJsonResult.data = null; |
| | | } |
| | | return objJsonResult; |
| | | } |
| | | #endregion |
| | | |
| | | #region 器具点检记录拍照上传 |
| | | [Route("Sc_MouldDotCheckBill/UploadFile")] |
| | | [HttpPost] |
| | | public object UploadFile() |
| | | { |
| | | |
| | | string HBillNo = HttpContext.Current.Request.Params["HBillNo"]; //单据号 |
| | | string HRemark = HttpContext.Current.Request.Params["HRemark"]; //备注 |
| | | string HUserName = HttpContext.Current.Request.Params["HUserName"]; //创建人 |
| | | HttpPostedFile files = HttpContext.Current.Request.Files["file"]; |
| | | string path = HttpContext.Current.Server.MapPath("~/../Files/MouldFolder/" + HBillNo); |
| | | //string path = @"D:\\Files\\"+ HBillNo; |
| | | dynamic dyResult = UpLoadFile(files, path, HBillNo, HRemark, HUserName); |
| | | if (dyResult != null && dyResult.result == 1) |
| | | { |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "上传成功!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | else |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = dyResult.returnval; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | } |
| | | |
| | | public dynamic UpLoadFile(HttpPostedFile files, string path, string HBillNo, string HRemark, string HUserName) |
| | | { |
| | | dynamic Result_Ob = new { result = 1, returnval = "上传成功!" }; |
| | | string filePath = Path.GetFullPath(files.FileName);//文件上传路径 |
| | | string fileExtension = Path.GetExtension(files.FileName);// 文件扩展名 |
| | | string filename = files.FileName;//文件名 |
| | | string fileSavePath = path;// 上传保存路径 |
| | | int filesize = files.ContentLength;//获取上传文件的大小单位为字节byte |
| | | int Maxsize = 40000 * 1024;//定义上传文件的最大空间大小为40M |
| | | try |
| | | { |
| | | if (files == null || files.ContentLength <= 0) |
| | | { |
| | | Result_Ob = new { result = 0, returnval = "文件不能为空!" }; |
| | | return Result_Ob; |
| | | } |
| | | if (filesize >= Maxsize) |
| | | { |
| | | Result_Ob = new { result = 0, returnval = "上传文件超过40M,不能上传!" }; |
| | | return Result_Ob; |
| | | } |
| | | |
| | | string fileurl = Path.Combine(fileSavePath, filename); |
| | | if (Directory.Exists(fileurl) == true) //如果存在重名文件就提示 |
| | | { |
| | | Result_Ob = new { result = 0, returnval = "存在同名文件!" }; |
| | | return Result_Ob; |
| | | } |
| | | //删除数据表数据 |
| | | ds = oCN.RunProcReturn("delete from MES_AccessoriesList where HSourceBillNo ='" + HBillNo + "' and HFileName='" + filename + "'", "MES_AccessoriesList"); |
| | | if (Directory.Exists(path)) |
| | | { |
| | | File.Delete(fileurl); //删除指定文件 |
| | | files.SaveAs(fileurl); |
| | | string StrPath = "/files/MouldFolder/" + HBillNo + "/" + filename; |
| | | if (File.Exists(fileurl)) |
| | | { |
| | | //这里可以执行一些其它的操作,比如更新数据库 |
| | | //写入数据表 |
| | | oCN.RunProc("Insert into MES_AccessoriesList (HFileName,HFilePath,HFilePath_Cus,HFileType" + |
| | | ",HLoadMan,HLoadDate,HRemark,HVerNum,HFileSize" + |
| | | ",HFileClsID,HSourceBillNo" + |
| | | ") values('" |
| | | + filename.ToString() + "','" + StrPath.ToString() + "','" + filePath.ToString() + "','" + fileExtension.ToString() + "'" + |
| | | ",'" + HUserName + "',getdate(),'" + HRemark + "','V1','" + filesize + |
| | | "','" + 0 + "','" + HBillNo + |
| | | "') "); |
| | | } |
| | | else |
| | | { |
| | | Result_Ob = new { result = 0, returnval = "上传失败!此文件为恶意文件" }; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | Directory.CreateDirectory(fileSavePath); //添加文件夹 |
| | | files.SaveAs(fileurl); |
| | | string StrPath = "/files/MouldFolder/" + HBillNo + "/" + filename; |
| | | if (File.Exists(fileurl)) |
| | | { |
| | | //这里可以执行一些其它的操作,比如更新数据库 |
| | | //写入数据表 |
| | | oCN.RunProc("Insert into MES_AccessoriesList (HFileName,HFilePath,HFilePath_Cus,HFileType" + |
| | | ",HLoadMan,HLoadDate,HRemark,HVerNum,HFileSize" + |
| | | ",HFileClsID,HSourceBillNo" + |
| | | ") values('" |
| | | + filename.ToString() + "','" + StrPath.ToString() + "','" + filePath.ToString() + "','" + fileExtension.ToString() + "'" + |
| | | ",'" + HUserName + "',getdate(),'" + HRemark + "','V1','" + filesize + |
| | | "','" + 0 + "','" + HBillNo + |
| | | "') "); |
| | | } |
| | | else |
| | | { |
| | | Result_Ob = new { result = 0, returnval = "上传失败!此文件为恶意文件" }; |
| | | } |
| | | } |
| | | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | Result_Ob = new { result = 0, returnval = e.Message }; |
| | | } |
| | | return Result_Ob; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 根据单据号查找上传文件列表 |
| | | /// </summary> |
| | | /// <param name="sWhere"></param> |
| | | /// <returns></returns> |
| | | [Route("Sc_MouldDotCheckBill/Filelist")] |
| | | [HttpGet] |
| | | public object Filelist(string HBillNo) |
| | | { |
| | | var url = fileip + "/files/MouldFolder/" + HBillNo + "/"; |
| | | //@"C:\\files\\" |
| | | try |
| | | { |
| | | ds = oCN.RunProcReturn("select *,'" + url + "'+CAST(HFileName as varchar(200))as url from MES_AccessoriesList where HSourceBillNo='" + HBillNo + "'", "MES_AccessoriesList"); |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "Sucess!"; |
| | | objJsonResult.data = ds.Tables[0]; |
| | | return objJsonResult; |
| | | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "Exception!" + e.ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 根据ID,单据号,文件名 删除文件 |
| | | /// </summary> |
| | | /// <param name="sWhere"></param> |
| | | /// <returns></returns> |
| | | [Route("Sc_MouldDotCheckBill/DeleteFilelist")] |
| | | [HttpGet] |
| | | public object DeleteFilelist(string HItemID, string HSourceBillNo, string HFileName) |
| | | { |
| | | try |
| | | { |
| | | |
| | | oCN.RunProc("delete from MES_AccessoriesList where HItemID =" + HItemID); |
| | | string fileurl = Path.Combine(HttpContext.Current.Server.MapPath("~/../Files/MouldFolder/" + HSourceBillNo), HFileName); |
| | | File.Delete(fileurl); //删除指定文件 |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "删除成功!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "Exception!" + e.ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #region 器具保养记录拍照上传 |
| | | [Route("Sc_MouldMaintainBill/UploadFile")] |
| | | [HttpPost] |
| | | public object UploadFile_Maintain() |
| | | { |
| | | |
| | | string HBillNo = HttpContext.Current.Request.Params["HBillNo"]; //单据号 |
| | | string HRemark = HttpContext.Current.Request.Params["HRemark"]; //备注 |
| | | string HUserName = HttpContext.Current.Request.Params["HUserName"]; //创建人 |
| | | HttpPostedFile files = HttpContext.Current.Request.Files["file"]; |
| | | string path = HttpContext.Current.Server.MapPath("~/../Files/MouldFolder/" + HBillNo); |
| | | //string path = @"D:\\Files\\"+ HBillNo; |
| | | dynamic dyResult = UpLoadFile_Maintain(files, path, HBillNo, HRemark, HUserName); |
| | | if (dyResult != null && dyResult.result == 1) |
| | | { |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "上传成功!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | else |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = dyResult.returnval; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | } |
| | | |
| | | public dynamic UpLoadFile_Maintain(HttpPostedFile files, string path, string HBillNo, string HRemark, string HUserName) |
| | | { |
| | | dynamic Result_Ob = new { result = 1, returnval = "上传成功!" }; |
| | | string filePath = Path.GetFullPath(files.FileName);//文件上传路径 |
| | | string fileExtension = Path.GetExtension(files.FileName);// 文件扩展名 |
| | | string filename = files.FileName;//文件名 |
| | | string fileSavePath = path;// 上传保存路径 |
| | | int filesize = files.ContentLength;//获取上传文件的大小单位为字节byte |
| | | int Maxsize = 40000 * 1024;//定义上传文件的最大空间大小为40M |
| | | try |
| | | { |
| | | if (files == null || files.ContentLength <= 0) |
| | | { |
| | | Result_Ob = new { result = 0, returnval = "文件不能为空!" }; |
| | | return Result_Ob; |
| | | } |
| | | if (filesize >= Maxsize) |
| | | { |
| | | Result_Ob = new { result = 0, returnval = "上传文件超过40M,不能上传!" }; |
| | | return Result_Ob; |
| | | } |
| | | |
| | | string fileurl = Path.Combine(fileSavePath, filename); |
| | | if (Directory.Exists(fileurl) == true) //如果存在重名文件就提示 |
| | | { |
| | | Result_Ob = new { result = 0, returnval = "存在同名文件!" }; |
| | | return Result_Ob; |
| | | } |
| | | //删除数据表数据 |
| | | ds = oCN.RunProcReturn("delete from MES_AccessoriesList where HSourceBillNo ='" + HBillNo + "' and HFileName='" + filename + "'", "MES_AccessoriesList"); |
| | | if (Directory.Exists(path)) |
| | | { |
| | | File.Delete(fileurl); //删除指定文件 |
| | | files.SaveAs(fileurl); |
| | | string StrPath = "/files/MouldFolder/" + HBillNo + "/" + filename; |
| | | if (File.Exists(fileurl)) |
| | | { |
| | | //这里可以执行一些其它的操作,比如更新数据库 |
| | | //写入数据表 |
| | | oCN.RunProc("Insert into MES_AccessoriesList (HFileName,HFilePath,HFilePath_Cus,HFileType" + |
| | | ",HLoadMan,HLoadDate,HRemark,HVerNum,HFileSize" + |
| | | ",HFileClsID,HSourceBillNo" + |
| | | ") values('" |
| | | + filename.ToString() + "','" + StrPath.ToString() + "','" + filePath.ToString() + "','" + fileExtension.ToString() + "'" + |
| | | ",'" + HUserName + "',getdate(),'" + HRemark + "','V1','" + filesize + |
| | | "','" + 0 + "','" + HBillNo + |
| | | "') "); |
| | | } |
| | | else |
| | | { |
| | | Result_Ob = new { result = 0, returnval = "上传失败!此文件为恶意文件" }; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | Directory.CreateDirectory(fileSavePath); //添加文件夹 |
| | | files.SaveAs(fileurl); |
| | | string StrPath = "/files/MouldFolder/" + HBillNo + "/" + filename; |
| | | if (File.Exists(fileurl)) |
| | | { |
| | | //这里可以执行一些其它的操作,比如更新数据库 |
| | | //写入数据表 |
| | | oCN.RunProc("Insert into MES_AccessoriesList (HFileName,HFilePath,HFilePath_Cus,HFileType" + |
| | | ",HLoadMan,HLoadDate,HRemark,HVerNum,HFileSize" + |
| | | ",HFileClsID,HSourceBillNo" + |
| | | ") values('" |
| | | + filename.ToString() + "','" + StrPath.ToString() + "','" + filePath.ToString() + "','" + fileExtension.ToString() + "'" + |
| | | ",'" + HUserName + "',getdate(),'" + HRemark + "','V1','" + filesize + |
| | | "','" + 0 + "','" + HBillNo + |
| | | "') "); |
| | | } |
| | | else |
| | | { |
| | | Result_Ob = new { result = 0, returnval = "上传失败!此文件为恶意文件" }; |
| | | } |
| | | } |
| | | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | Result_Ob = new { result = 0, returnval = e.Message }; |
| | | } |
| | | return Result_Ob; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 根据单据号查找上传文件列表 |
| | | /// </summary> |
| | | /// <param name="sWhere"></param> |
| | | /// <returns></returns> |
| | | [Route("Sc_MouldMaintainBill/Filelist")] |
| | | [HttpGet] |
| | | public object Filelist_Maintain(string HBillNo) |
| | | { |
| | | var url = fileip + "/files/MouldFolder/" + HBillNo + "/"; |
| | | //@"C:\\files\\" |
| | | try |
| | | { |
| | | ds = oCN.RunProcReturn("select *,'" + url + "'+CAST(HFileName as varchar(200))as url from MES_AccessoriesList where HSourceBillNo='" + HBillNo + "'", "MES_AccessoriesList"); |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "Sucess!"; |
| | | objJsonResult.data = ds.Tables[0]; |
| | | return objJsonResult; |
| | | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "Exception!" + e.ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 根据ID,单据号,文件名 删除文件 |
| | | /// </summary> |
| | | /// <param name="sWhere"></param> |
| | | /// <returns></returns> |
| | | [Route("Sc_MouldMaintainBill/DeleteFilelist")] |
| | | [HttpGet] |
| | | public object DeleteFilelist_Maintain(string HItemID, string HSourceBillNo, string HFileName) |
| | | { |
| | | try |
| | | { |
| | | |
| | | oCN.RunProc("delete from MES_AccessoriesList where HItemID =" + HItemID); |
| | | string fileurl = Path.Combine(HttpContext.Current.Server.MapPath("~/../Files/MouldFolder/" + HSourceBillNo), HFileName); |
| | | File.Delete(fileurl); //删除指定文件 |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "删除成功!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "Exception!" + e.ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | } |
| | | } |