|  |  |  | 
|---|
|  |  |  | 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> | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | #endregion | 
|---|
|  |  |  |  | 
|---|
|  |  |  | #region 器具寿命耗用分析报表 | 
|---|
|  |  |  | [Route("Sc_MouldRepairInBillList/Get_Sc_MouldLifeUsePicReport")] | 
|---|
|  |  |  | [HttpGet] | 
|---|
|  |  |  | public object Get_Sc_MouldLifeUsePicReport(string sWhere) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | try | 
|---|
|  |  |  | { | 
|---|
|  |  |  | List<object> columnNameList = new List<object>(); | 
|---|
|  |  |  | if (sWhere == null || sWhere.Equals("")) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | ds = oCN.RunProcReturn("select * from h_v_Sc_MouldLifeUsePicReport order by 月份 desc", "h_v_Sc_MouldLifeUsePicReport"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | else | 
|---|
|  |  |  | { | 
|---|
|  |  |  | string sql1 = "select * from h_v_Sc_MouldLifeUsePicReport where 1 = 1 "; | 
|---|
|  |  |  | string sql = sql1 + sWhere + " order by 日期 "; | 
|---|
|  |  |  | ds = oCN.RunProcReturn(sql, "h_v_Sc_MouldLifeUsePicReport"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | //添加列名 | 
|---|
|  |  |  | foreach (DataColumn col in ds.Tables[0].Columns) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | Type dataType = col.DataType; | 
|---|
|  |  |  | string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}"; | 
|---|
|  |  |  | columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//获取到DataColumn列对象的列名 | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | objJsonResult.code = "1"; | 
|---|
|  |  |  | objJsonResult.count = 1; | 
|---|
|  |  |  | objJsonResult.Message = "Sucess!"; | 
|---|
|  |  |  | objJsonResult.data = ds.Tables[0]; | 
|---|
|  |  |  | objJsonResult.list = columnNameList; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | catch (Exception e) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | objJsonResult.count = 0; | 
|---|
|  |  |  | objJsonResult.Message = "Exception!" + e.ToString(); | 
|---|
|  |  |  | objJsonResult.data = null; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | #endregion | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /// <summary> | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | //================================================================================== | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //更新及时库存表   减少调入库存,增加调出库存 | 
|---|
|  |  |  | ds = oCN.RunProcReturn("exec h_KF_UPDateICinventory_Move  '"+ oBill.omodel.HInterID + "','"+ oBill.omodel.HBillType+ "','1'", "h_KF_UPDateICinventory_Move"); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //审核单据 | 
|---|
|  |  |  | if (!oBill.CheckBill(oBill.omodel.HInterID, oBill.omodel.HBillNo, "h_p_Kf_MoveStockBill_AfterCheckCtrl", user, ref DBUtility.ClsPub.sExeReturnInfo) == true) | 
|---|
|  |  |  | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | //=========================================================== | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //更新及时库存表   增加调入库存,减少调出库存 | 
|---|
|  |  |  | ds = oCN.RunProcReturn("exec h_KF_UPDateICinventory_Move  '" + oBill.omodel.HInterID + "','" + oBill.omodel.HBillType + "','2'", "h_KF_UPDateICinventory_Move"); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //反审核单据 | 
|---|
|  |  |  | if (oBill.AbandonCheck(oBill.omodel.HInterID, oBill.omodel.HBillNo, "h_p_Kf_MoveStockBill_AfterUnCheckCtrl", user, ref DBUtility.ClsPub.sExeReturnInfo) == true) | 
|---|
|  |  |  | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | #region 销售出库单列表-分页 | 
|---|
|  |  |  | /// <summary> | 
|---|
|  |  |  | /// 销售出库单列表 | 
|---|
|  |  |  | /// </summary> | 
|---|
|  |  |  | /// <returns></returns> | 
|---|
|  |  |  | [Route("Kf_SellOutBill/GetSellOutBillList_byPage")] | 
|---|
|  |  |  | [HttpGet] | 
|---|
|  |  |  | public object GetSellOutBillList_byPage(string sWhere, string user, string Organization, int page, int size) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | try | 
|---|
|  |  |  | { | 
|---|
|  |  |  | List<object> columnNameList = new List<object>();  //定义声明变量 ,把通过 new List<object>()创建的 实例,赋值给变量 | 
|---|
|  |  |  | //判断是否有查询权限 | 
|---|
|  |  |  | if (!DBUtility.ClsPub.Security_Log("Kf_SellOutBillQuery", 1, false, user)) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | objJsonResult.count = 0; | 
|---|
|  |  |  | objJsonResult.Message = "没有查询权限!"; | 
|---|
|  |  |  | objJsonResult.data = null; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | sWhere = sWhere.Replace("'", "''"); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (sWhere == null || sWhere.Equals("")) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | ds = oCN.RunProcReturn("exec h_p_IF_SellOutBillList " + page + "," + size + ",'" + Organization + "'," + "''", "h_p_IF_SellOutBillList"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | else | 
|---|
|  |  |  | { | 
|---|
|  |  |  | ds = oCN.RunProcReturn("exec h_p_IF_SellOutBillList " + page + "," + size + ",'" + Organization + "','" + sWhere + "'", "h_p_IF_SellOutBillList"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //添加列名 | 
|---|
|  |  |  | foreach (DataColumn col in ds.Tables[0].Columns) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | Type dataType = col.DataType; | 
|---|
|  |  |  | string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}"; | 
|---|
|  |  |  | columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//获取到DataColumn列对象的列名 | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | objJsonResult.code = "1"; | 
|---|
|  |  |  | objJsonResult.count = int.Parse(ds.Tables[1].Rows[0]["count"].ToString()); | 
|---|
|  |  |  | objJsonResult.Message = "Sucess!"; | 
|---|
|  |  |  | objJsonResult.list = columnNameList; | 
|---|
|  |  |  | objJsonResult.data = ds.Tables[0]; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | catch (Exception ex) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | objJsonResult.count = 0; | 
|---|
|  |  |  | objJsonResult.Message = "没有返回任何记录!" + ex.ToString(); | 
|---|
|  |  |  | objJsonResult.data = null; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | #endregion | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /// <summary> | 
|---|
|  |  |  | ///销售出库单删除功能 | 
|---|
|  |  |  | /// </summary> | 
|---|
|  |  |  | 
|---|
|  |  |  | 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; | 
|---|
|  |  |  | 
|---|
|  |  |  | oCN.RunProc("exec h_p_Xs_UpDateRelation_SeOutStockToPOStockIn_Delete " + HInterID); | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //oCN.RunProc("Delete From Kf_ICStockBillMain where HInterID = " + HInterID); | 
|---|
|  |  |  | //oCN.RunProc("Delete From Kf_ICStockBillSub where HInterID = " + HInterID); | 
|---|
|  |  |  | 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 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(); | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | //================================================================================== | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //审核单据 | 
|---|
|  |  |  | 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) | 
|---|
|  |  |  | 
|---|
|  |  |  | lsmain = oListModels.getObjectByJson_Gy_MouldRepairWorkBillMain(msg2); | 
|---|
|  |  |  | foreach (Model.ClsSb_MouldRepairWorkBillMain oItem in lsmain) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | //oItem.HMaker = ""; | 
|---|
|  |  |  | oItem.HMaker = msg4; | 
|---|
|  |  |  | UserName = msg4;  //制单人 | 
|---|
|  |  |  | oItem.HBillType = "3807"; | 
|---|
|  |  |  | oItem.HBillSubType = "3807"; | 
|---|
|  |  |  | 
|---|
|  |  |  | { | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //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"); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | string msg3 = sArray[1].ToString(); | 
|---|
|  |  |  | string msg4 = sArray[2].ToString(); | 
|---|
|  |  |  | string msg5 = sArray[3].ToString(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | string msg6 = sArray[4].ToString(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | string UserName = ""; | 
|---|
|  |  |  | ListModels oListModels = new ListModels(); | 
|---|
|  |  |  | 
|---|
|  |  |  | //oItem.HBillNo = ""; | 
|---|
|  |  |  | oItem.HDate = DBUtility.ClsPub.isDate(DateTime.Now.ToString("yyyy-MM-dd"));//  --日期 | 
|---|
|  |  |  | oItem.HYear = DBUtility.ClsPub.isLong(DateTime.Now.Year); | 
|---|
|  |  |  | oItem.HPeriod = DBUtility.ClsPub.isLong(DateTime.Now.Month); | 
|---|
|  |  |  | //oItem.HMakeDate = ""; | 
|---|
|  |  |  | //oItem.HYear = ""; | 
|---|
|  |  |  | //oItem.HPeriod = ""; | 
|---|
|  |  |  | 
|---|
|  |  |  | oBill.DetailColl.Add(oItemSub); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //表体数据 | 
|---|
|  |  |  | //按 },{来拆分数组 //去掉【和】 | 
|---|
|  |  |  | //如果是编辑就允许保存,否则不允许 | 
|---|
|  |  |  | if (oBill.omodel.HInterID != 0) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | msg6 = msg6.Substring(1, msg6.Length - 2); | 
|---|
|  |  |  | msg6 = msg6.Replace("\\", ""); | 
|---|
|  |  |  | msg6 = msg6.Replace("\n", ""); | 
|---|
|  |  |  | List<Model.ClsSc_MouldMaintainPlanBillSub_Plan> lss = new List<Model.ClsSc_MouldMaintainPlanBillSub_Plan>(); | 
|---|
|  |  |  | lss = oListModels.getObjectByJson_Sc_MouldMaintainPlanBillSub_Plan(msg6); | 
|---|
|  |  |  | int l = 0; | 
|---|
|  |  |  | foreach (Model.ClsSc_MouldMaintainPlanBillSub_Plan oItem in lss) | 
|---|
|  |  |  | { | 
|---|
|  |  |  |  | 
|---|
|  |  |  | l++; | 
|---|
|  |  |  | oItem.HEntryID = l; | 
|---|
|  |  |  | oItem.HEntryCloseDate = DBUtility.ClsPub.isDate(DateTime.Now); | 
|---|
|  |  |  | oItem.HCloseType = false;   //关闭类型 | 
|---|
|  |  |  | oItem.HSourceInterID = 0;     // 源单主内码 | 
|---|
|  |  |  | oItem.HSourceEntryID = 0;   //源单子内码 | 
|---|
|  |  |  | oItem.HRelationQty = 0;     //关联数量 | 
|---|
|  |  |  | oBill.DetailCol2.Add(oItem); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //保存 | 
|---|
|  |  |  | //保存完毕后处理 | 
|---|
|  |  |  | bool bResult; | 
|---|
|  |  |  | 
|---|
|  |  |  | { | 
|---|
|  |  |  | 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"); | 
|---|
|  |  |  | //获取配件项目编辑数据 | 
|---|
|  |  |  | 
|---|
|  |  |  | foreach (Model.ClsSc_MouldMaintainBillMain oItem in lsmain) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | UserName = oItem.HMaker;  //制单人 | 
|---|
|  |  |  | DBUtility.ClsPub.CurUserName = UserName; | 
|---|
|  |  |  | DBUtility.ClsPub.CurUserName = msg5; | 
|---|
|  |  |  | oItem.HBillType = "3819"; | 
|---|
|  |  |  | oItem.HBillSubType = "3819"; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | #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 + ""; | 
|---|
|  |  |  | 
|---|
|  |  |  | string msg2 = sArray[0].ToString(); | 
|---|
|  |  |  | string msg3 = sArray[1].ToString(); | 
|---|
|  |  |  | string msg4 = sArray[2].ToString(); | 
|---|
|  |  |  | //string msg5 = sArray[3].ToString(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | string UserName = ""; | 
|---|
|  |  |  | ListModels oListModels = new ListModels(); | 
|---|
|  |  |  | 
|---|
|  |  |  | msg2 = msg2.Replace("\n", "");  //\n | 
|---|
|  |  |  | lsmain = oListModels.getObjectByJson_Sc_MouldDotCheckPlanBillMain(msg2); | 
|---|
|  |  |  | foreach (Model.ClsSc_MouldDotCheckPlanBillMain oItem in lsmain) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | //oItem.HMaker = ""; | 
|---|
|  |  |  | { | 
|---|
|  |  |  | UserName = oItem.HMaker;  //制单人 | 
|---|
|  |  |  | oItem.HBillType = "3820"; | 
|---|
|  |  |  | oItem.HBillSubType = "3820"; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //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); | 
|---|
|  |  |  | oItem.HYear = DBUtility.ClsPub.isLong(DateTime.Now.Year); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (DBUtility.ClsPub.isStrNull(oItem.HDate) == "") | 
|---|
|  |  |  | { | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | i++; | 
|---|
|  |  |  | oItemSub.HEntryID = i; | 
|---|
|  |  |  | //oItemSub.HCloseMan = "";       //行关闭 | 
|---|
|  |  |  |  | 
|---|
|  |  |  | oItemSub.HEntryCloseDate = DBUtility.ClsPub.isDate(DateTime.Now); | 
|---|
|  |  |  | oItemSub.HCloseType = false;   //关闭类型 | 
|---|
|  |  |  | //oItemSub.HRemark = "";         //备注 | 
|---|
|  |  |  | 
|---|
|  |  |  | oItemSub.HSourceEntryID = 0;   //源单子内码 | 
|---|
|  |  |  | //oItemSub.HSourceBillNo = "";  //源单单号 | 
|---|
|  |  |  | //oItemSub.HSourceBillType = ""; //源单类型 | 
|---|
|  |  |  | oItemSub.HRelationQty = 0;     //关联数量 | 
|---|
|  |  |  | //oItemSub.HRelationMoney = 0;   //关联金额 | 
|---|
|  |  |  | //HMaterID = "";//配件代码 | 
|---|
|  |  |  | //HUnitID = "";//单位代码 | 
|---|
|  |  |  | //HQty = "";//实际用量 | 
|---|
|  |  |  | //HQtyMust = "";//单位用量 | 
|---|
|  |  |  | //HRemark = "";//备注 | 
|---|
|  |  |  | oItemSub.HRelationQty = 0;     //关联数量 | 
|---|
|  |  |  |  | 
|---|
|  |  |  | oBill.DetailColl.Add(oItemSub); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | ////配件项表体数据 | 
|---|
|  |  |  | ////按 },{来拆分数组 //去掉【和】 | 
|---|
|  |  |  | //msg5 = msg5.Substring(1, msg5.Length - 2); | 
|---|
|  |  |  | //msg5 = msg5.Replace("\\", ""); | 
|---|
|  |  |  | //msg5 = msg5.Replace("\n", "");  //\n | 
|---|
|  |  |  | //                                //msg2 = msg2.Replace("'", "’"); | 
|---|
|  |  |  | //List<Model.ClsSc_MouldDotCheckPlanBillSub_Item> ls1 = new List<Model.ClsSc_MouldDotCheckPlanBillSub_Item>(); | 
|---|
|  |  |  | //ls1 = oListModels.getObjectByJson_Sc_MouldDotCheckPlanBillSub_Item(msg5); | 
|---|
|  |  |  | //int j = 0; | 
|---|
|  |  |  | //foreach (Model.ClsSc_MouldDotCheckPlanBillSub_Item oItemSub in ls1) | 
|---|
|  |  |  | //{ | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //    j++; | 
|---|
|  |  |  | //    oItemSub.HEntryID = j; | 
|---|
|  |  |  | //    //oItemSub.HCloseMan = "";       //行关闭 | 
|---|
|  |  |  | //    oItemSub.HEntryCloseDate = DBUtility.ClsPub.isDate(DateTime.Now); | 
|---|
|  |  |  | //    oItemSub.HCloseType = false;   //关闭类型 | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //    oItemSub.HSourceInterID = 0;     // 源单主内码 | 
|---|
|  |  |  | //    oItemSub.HSourceEntryID = 0;   //源单子内码 | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //    oItemSub.HRelationQty = 0;     //关联数量 | 
|---|
|  |  |  | //    oBill.DetailCol.Add(oItemSub); | 
|---|
|  |  |  | //} | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | //保存 | 
|---|
|  |  |  | //保存完毕后处理 | 
|---|
|  |  |  | bool bResult; | 
|---|
|  |  |  | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | //得到信息 | 
|---|
|  |  |  | ds = oCN.RunProcReturn("select top 1 * from Gy_MouldFileMain  where HNumber= '" + HBarCode + "'", "Gy_MouldFileMain"); | 
|---|
|  |  |  | ds = oCN.RunProcReturn("select top 1 * from Gy_MouldFileMain  where HBarCode= '" + HBarCode + "'", "Gy_MouldFileMain"); | 
|---|
|  |  |  | //写入信息 | 
|---|
|  |  |  | if (ds == null || ds.Tables[0].Rows.Count == 0) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | #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; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | 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 | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|