yangle
2022-12-19 cbb4d47b6f79fa8663697862a975ed94acfb76be
WebAPI/Controllers/Sc_MouldRepairInBillListController.cs
@@ -1,4 +1,5 @@
using Newtonsoft.Json.Linq;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using Pub_Class;
using System;
using System.Collections.Generic;
@@ -188,6 +189,8 @@
        {
            try
            {
                List<object> columnNameList = new List<object>();
                if (!DBUtility.ClsPub.Security_Log("Sc_MouldMaintainBillList", 1, false, user))
                {
                    objJsonResult.code = "0";
@@ -199,12 +202,20 @@
                ds = Sc_MouldMaintainBillList_s(sWhere);
                //添加列名
                foreach (DataColumn col in ds.Tables[0].Columns)
                {
                    Type dataType = col.DataType;
                    string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}";
                    columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//获取到DataColumn列对象的列名
                }
                //if (ds.Tables[0].Rows.Count != 0 || ds != null)
                //{
                objJsonResult.code = "1";
                objJsonResult.count = 1;
                objJsonResult.Message = "Sucess!";
                objJsonResult.data = ds.Tables[0];
                objJsonResult.list = columnNameList;
                return objJsonResult;
                //}
                //else
@@ -269,22 +280,13 @@
                ds = Sc_MouldDotCheckPlanBillList_s(sWhere);
                //if (ds.Tables[0].Rows.Count != 0 || ds != null)
                //{
                objJsonResult.code = "1";
                objJsonResult.count = 1;
                objJsonResult.Message = "Sucess!";
                objJsonResult.data = ds.Tables[0];
                return objJsonResult;
                //}
                //else
                //{
                //objJsonResult.code = "0";
                //objJsonResult.count = 0;
                //objJsonResult.Message = "无数据";
                //objJsonResult.data = null;
                //return objJsonResult;
                //}
            }
            catch (Exception ex)
            {
@@ -315,6 +317,7 @@
        {
            try
            {
                List<object> columnNameList = new List<object>();
                if (!DBUtility.ClsPub.Security_Log("Sc_MouldDotCheckBillList", 1, false, user))
                {
                    objJsonResult.code = "0";
@@ -325,12 +328,22 @@
                }
                ds = Sc_MouldDotCheckBillList_s(sWhere);
                //添加列名
                foreach (DataColumn col in ds.Tables[0].Columns)
                {
                    Type dataType = col.DataType;
                    string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}";
                    columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//获取到DataColumn列对象的列名
                }
                //if (ds.Tables[0].Rows.Count != 0 || ds != null)
                //{
                objJsonResult.code = "1";
                objJsonResult.count = 1;
                objJsonResult.Message = "Sucess!";
                objJsonResult.data = ds.Tables[0];
                objJsonResult.list = columnNameList;
                return objJsonResult;
                //}
                //else
@@ -479,6 +492,7 @@
        {
            try
            {
                List<object> columnNameList = new List<object>();
                if (!DBUtility.ClsPub.Security_Log("Sc_MouldConkBookBillList", 1, false, user))
                {
                    objJsonResult.code = "0";
@@ -490,10 +504,19 @@
                ds = Sc_MouldConkBookBillList_s(sWhere);
                //添加列名
                foreach (DataColumn col in ds.Tables[0].Columns)
                {
                    Type dataType = col.DataType;
                    string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}";
                    columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//获取到DataColumn列对象的列名
                }
                objJsonResult.code = "1";
                objJsonResult.count = 1;
                objJsonResult.Message = "Sucess!";
                objJsonResult.data = ds.Tables[0];
                objJsonResult.list = columnNameList;
                return objJsonResult;
            }
            catch (Exception ex)
@@ -654,6 +677,7 @@
        {
            try
            {
                List<object> columnNameList = new List<object>();
                if (!DBUtility.ClsPub.Security_Log("Sb_MouldRepairWorkBillList", 1, false, user))
                {
                    objJsonResult.code = "0";
@@ -665,12 +689,21 @@
                ds = Sc_MouldRepairWorkBillList_s(sWhere);
                //添加列名
                foreach (DataColumn col in ds.Tables[0].Columns)
                {
                    Type dataType = col.DataType;
                    string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}";
                    columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//获取到DataColumn列对象的列名
                }
                //if (ds.Tables[0].Rows.Count != 0 || ds != null)
                //{
                objJsonResult.code = "1";
                objJsonResult.count = 1;
                objJsonResult.Message = "Sucess!";
                objJsonResult.data = ds.Tables[0];
                objJsonResult.list = columnNameList;
                return objJsonResult;
                //}
                //else
@@ -839,22 +872,12 @@
                    ds = oCN.RunProcReturn(sql, "h_v_IF_MoveStockBillList");
                }
                //if (ds.Tables[0].Rows.Count != 0 || ds != null)
                //{
                objJsonResult.code = "1";
                objJsonResult.count = 1;
                objJsonResult.Message = "Sucess!";
                objJsonResult.data = ds.Tables[0];
                return objJsonResult;
                //}
                //else
                //{
                //objJsonResult.code = "0";
                //objJsonResult.count = 0;
                //objJsonResult.Message = "无数据";
                //objJsonResult.data = null;
                //return objJsonResult;
                //}
            }
            catch (Exception ex)
            {
@@ -865,6 +888,46 @@
                return objJsonResult;
            }
        }
        #region 调拨单  删除
        [Route("Kf_MoveStockBill/DelteteGetMoveStockBill")]
        [HttpGet]
        public object DelteteGetMoveStockBill(string HInterID, string user)
        {
            try
            {
                //判断是否有删除权限
                if (!DBUtility.ClsPub.Security_Log("Kf_MoveStockBill_Drop", 1, false, user))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "无权限删除!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                oCN.BeginTran();
                oCN.RunProc("Delete From Kf_ICStockBillMain where HInterID = " + HInterID);
                oCN.RunProc("Delete From Kf_ICStockBillSub where HInterID = " + HInterID);
                oCN.Commit();
                objJsonResult.code = "1";
                objJsonResult.count = 1;
                objJsonResult.Message = "删除成功!";
                objJsonResult.data = null;
                return objJsonResult;
            }
            catch (Exception e)
            {
                oCN.RollBack();
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "Exception!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
        /// <summary>
        /// 销售出库单列表
@@ -1028,6 +1091,44 @@
            }
        }
        #region 其他出库单  删除
        [Route("Kf_OtherOutBill/DelteteGetOtherOutBill")]
        [HttpGet]
        public object DelteteGetOtherOutBill(string HInterID, string user)
        {
            try
            {
                //判断是否有删除权限
                if (!DBUtility.ClsPub.Security_Log("Kf_OtherOutBill_Drop", 1, false, user))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "无权限删除!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                oCN.BeginTran();
                oCN.RunProc("Delete From Kf_ICStockBillMain where HInterID = " + HInterID);
                oCN.RunProc("Delete From Kf_ICStockBillSub where HInterID = " + HInterID);
                oCN.Commit();
                objJsonResult.code = "1";
                objJsonResult.count = 1;
                objJsonResult.Message = "删除成功!";
                objJsonResult.data = null;
                return objJsonResult;
            }
            catch (Exception e)
            {
                oCN.RollBack();
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "Exception!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
        /// <summary>
        /// 委外出库单列表
@@ -1159,22 +1260,13 @@
                    ds = oCN.RunProcReturn(sql, "h_v_IF_ProductInBillList");
                }
                //if (ds.Tables[0].Rows.Count != 0 || ds != null)
                //{
                objJsonResult.code = "1";
                objJsonResult.count = 1;
                objJsonResult.Message = "Sucess!";
                objJsonResult.data = ds.Tables[0];
                return objJsonResult;
                //}
                //else
                //{
                //objJsonResult.code = "0";
                //objJsonResult.count = 0;
                //objJsonResult.Message = "无数据";
                //objJsonResult.data = null;
                //return objJsonResult;
                //}
            }
            catch (Exception ex)
            {
@@ -1185,7 +1277,37 @@
                return objJsonResult;
            }
        }
        #region 条码明细
        [Route("Kf_ICStockBillSub_WMS/Kf_ICStockBillSub_WMS_List")]
        [HttpGet]
        public object Kf_ICStockBillSub_WMS_List(string sWhere, string user)
        {
            try
            {
                ds = oCN.RunProcReturn(@"Select m.HNumber 物料代码,m.HName 物料名称,m.HModel 规格型号
                                    ,wms.HBarCode 条码,wms.HQty 数量,w.HNumber 仓库代码,w.HName 仓库名称 from Kf_ICStockBillSub_WMS wms
                                    left join h_v_IF_Material m on wms.HMaterID = m.HItemID
                                    left join h_v_IF_Warehouse w on wms.HWhID = w.HItemID where 1=1 "+ sWhere, "Kf_ICStockBillSub_WMS");
                objJsonResult.code = "1";
                objJsonResult.count = 1;
                objJsonResult.Message = "Sucess!";
                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>
@@ -2383,6 +2505,7 @@
            string msg2 = sArray[0].ToString();
            string msg3 = sArray[1].ToString();
            string msg4 = sArray[2].ToString();
            string msg5 = sArray[3].ToString();
            string UserName = "";
@@ -2436,6 +2559,34 @@
                    }
                    oBill.omodel = oItem;
                }
                //保养项表体数据
                //按 },{来拆分数组 //去掉【和】
                msg5 = msg5.Substring(1, msg5.Length - 2);
                msg5 = msg5.Replace("\\", "");
                msg5 = msg5.Replace("\n", "");  //\n
                //msg2 = msg2.Replace("'", "’");
                List<Model.ClsSc_MouldMaintainPlanBillSub_Item> ls1 = new List<Model.ClsSc_MouldMaintainPlanBillSub_Item>();
                ls1 = oListModels.getObjectByJson_Gy_MouldMaintainPlanBillSub_Item(msg5);
                int j = 0;
                foreach (Model.ClsSc_MouldMaintainPlanBillSub_Item item in ls1)
                {
                    j++;
                    item.HEntryID = j;
                    //oItemSub.HCloseMan = "";       //行关闭
                    item.HEntryCloseDate = DBUtility.ClsPub.isDate(DateTime.Now);
                    item.HCloseType = false;   //关闭类型
                    //oItemSub.HRemark = "";         //备注
                    item.HSourceInterID = 0;     // 源单主内码
                    item.HSourceEntryID = 0;   //源单子内码
                    //oItemSub.HSourceBillNo = "";  //源单单号
                    //oItemSub.HSourceBillType = ""; //源单类型
                    item.HRelationQty = 0;     //关联数量
                    oBill.DetailCol.Add(item);
                }
                //表体数据
                //按 },{来拆分数组 //去掉【和】
                msg3 = msg3.Substring(1, msg3.Length - 2);
@@ -2531,28 +2682,28 @@
        [HttpGet]
        public object Sc_MouldMaintainPlanBillListProjectDetai(string sqlWhere)
        {
            DataSet ds;
            DataSet ds, ds1;
            List<object> list = new List<object>();
            try
            {
                SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
                if (sqlWhere == null || sqlWhere.Equals(""))
                {
                    ds = oCN.RunProcReturn("select a.HMaterID,m.HNumber HMaterNumber,m.HName HMaterName,a.HUnitID,u.HNumber HUnitNumber,u.HName HUnitName,a.HQty,a.HQtyMust,a.HRemark  from Sc_MouldMaintainPlanBillSub a left join Gy_Unit u on a.HUnitID=u.HItemID left join h_v_IF_Material m on a.HMaterID=m.HItemID", "Sc_MouldMaintainPlanBillSub");
                    objJsonResult.code = "0";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "获取信息成功!";
                    objJsonResult.data = ds.Tables[0];
                }
                else
                {
                    string sql1 = "select a.HMaterID,m.HNumber HMaterNumber,m.HName HMaterName,a.HUnitID,u.HNumber HUnitNumber,u.HName HUnitName,a.HQty,a.HQtyMust,a.HRemark  from Sc_MouldMaintainPlanBillSub a left join Gy_Unit u on a.HUnitID=u.HItemID left join h_v_IF_Material m on a.HMaterID=m.HItemID where 1 = 1 ";
                    string sql = sql1 + sqlWhere;
                    ds = oCN.RunProcReturn(sql, "Sc_MouldMaintainPlanBillSub");
                    objJsonResult.code = "0";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "获取信息成功!";
                    objJsonResult.data = ds.Tables[0];
                }
                //获取保养项目编辑数据
                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 + "";
                ds = oCN.RunProcReturn(sql, "h_v_Sc_MouldMaintainPlanBillSub_Item");
                //获取配件项目编辑数据
                string sql1 = "select 配件ID HMaterID, 配件代码 HMaterNumber,配件名称 HMaterName,单位ID HUnitID,计量单位代码 HUnitNumber,计量单位名称 HUnitName,用量 HQty,标准用量 HQtyMust,子备注1 HRemark,规格型号 HMaterSpec  from h_v_Sc_MouldMaintainPlanBillSub  where 1 = 1 " + sqlWhere + "";
                ds1 = oCN.RunProcReturn(sql1, "h_v_Sc_MouldMaintainPlanBillSub");
                list.Add(ds.Tables[0]);
                list.Add(ds1.Tables[0]);
                objJsonResult.code = "0";
                objJsonResult.count = 1;
                objJsonResult.Message = "获取信息成功!";
                objJsonResult.data = null;
                objJsonResult.list = list;
            }
            catch (Exception e)
            {
@@ -5544,6 +5695,8 @@
        {
            try
            {
                List<object> columnNameList = new List<object>();
                if (!DBUtility.ClsPub.Security_Log("Sc_MouldLifeChangeBillList", 1, false, user))
                {
                    objJsonResult.code = "0";
@@ -5555,10 +5708,19 @@
                ds = Sc_GetMouldLifeChangeBill(sWhere);
                //添加列名
                foreach (DataColumn col in ds.Tables[0].Columns)
                {
                    Type dataType = col.DataType;
                    string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}";
                    columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//获取到DataColumn列对象的列名
                }
                objJsonResult.code = "1";
                objJsonResult.count = 1;
                objJsonResult.Message = "返回记录成功!";
                objJsonResult.data = ds.Tables[0];
                objJsonResult.list = columnNameList;
                return objJsonResult;
            }
            catch (Exception ex)
@@ -5619,7 +5781,7 @@
                    ds = oCN.RunProcReturn(string.Format(@"SELECT HMaterID,模具代码 HMaterCode,模具 HMaterName,规格型号 HMaterSpec,HPropertyID,辅助属性代码 HPropertyCode,辅助属性 HPropertyName,
                                                           HSecUnitID, 辅助计量单位代码 HSecUnitCode, 辅助计量单位 HSecUnitName,换算率 HSecUnitRate,
                                                           HUnitID, 计量单位代码 HUnitCode, 计量单位 HUnitName,
                                                           设计寿命 HDesignLife, 原剩余寿命 HLeaveLife, 新剩余寿命 HNewLife,表体备注 HRemark
                                                           设计寿命 HDesignLife, 原剩余寿命 HLeaveLife, 新剩余寿命 HNewLeaveLife,表体备注 HRemark
                                                          FROM h_v_Sc_MouldLifeChangeBillList_Edit"), "h_v_Sc_MouldLifeChangeBillList_Edit");
                    objJsonResult.code = "0";
@@ -5634,7 +5796,7 @@
                    string sql1 = string.Format(@"SELECT HMaterID,模具代码 HMaterCode,模具 HMaterName,规格型号 HMaterSpec,HPropertyID,辅助属性代码 HPropertyCode,辅助属性 HPropertyName,
                                                  HSecUnitID, 辅助计量单位代码 HSecUnitCode, 辅助计量单位 HSecUnitName,换算率 HSecUnitRate,
                                                  HUnitID, 计量单位代码 HUnitCode, 计量单位 HUnitName,
                                                  设计寿命 HDesignLife, 原剩余寿命 HLeaveLife, 新剩余寿命 HNewLife,表体备注 HRemark
                                                  设计寿命 HDesignLife, 原剩余寿命 HLeaveLife, 新剩余寿命 HNewLeaveLife,表体备注 HRemark
                                                 FROM h_v_Sc_MouldLifeChangeBillList_Edit where 1 = 1 ");
                    string sql = sql1 + sqlWhere;
                    ds = oCN.RunProcReturn(sql, "h_v_Sc_MouldLifeChangeBillList_Edit");