yangle
2024-09-25 0f2bdefca1bcfada65aafe33234e5e4d69522ce7
WebAPI/Controllers/MJGL/Sc_MouldDotCheckRuleBillController.cs
@@ -68,6 +68,56 @@
        }
        #endregion
        #region 器具点检规程单列表
        [Route("Sc_MouldDotCheckRuleBill/Sc_MouldDotCheckRuleListPDA")]
        [HttpGet]
        public object Sc_MouldDotCheckRuleListPDA(string sWhere, string user)
        {
            try
            {
                List<object> columnNameList = new List<object>();
                //反序列化传递的值
                //HlpBill com = JsonConvert.DeserializeObject<HlpBill>(sWhere.ToString());
                //编辑权限
                if (!DBUtility.ClsPub.Security_Log("Sc_MouldDotCheckRuleBillList", 1, false, user))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "无查看权限!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                string sql = "select * from h_v_Sc_MouldDotCheckRuleListByMould where 1 = 1" + sWhere + " order by hmainid desc";
                ds = oCN.RunProcReturn(sql, "h_v_Sc_MouldDotCheckRuleListByMould");
                //添加列名
                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)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "没有返回任何记录!" + ex.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
        #region 器具点检规程 保存/编辑
        /// <summary>
        /// 保存模具维修单
@@ -83,8 +133,7 @@
            string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
            string msg2 = sArray[0].ToString();
            string msg3 = sArray[1].ToString();
            string msg4 = sArray[2].ToString();
            string msg5 = sArray[3].ToString();
            string msg5 = sArray[2].ToString();
            string UserName = "";
            ListModels oListModels = new ListModels();
@@ -147,35 +196,35 @@
                    item.HSourceInterID = 0;     // 源单主内码
                    item.HSourceEntryID = 0;   //源单子内码
                    item.HRelationQty = 0;     //关联数量
                    oBill.DetailCol.Add(item);
                    oBill.DetailColl.Add(item);
                }
                //配件项表体数据
                //按 },{来拆分数组 //去掉【和】
                msg4 = msg4.Substring(1, msg4.Length - 2);
                msg4 = msg4.Replace("\\", "");
                msg4 = msg4.Replace("\n", "");  //\n
                                                //msg2 = msg2.Replace("'", "’");
                List<Model.ClsSc_MouldDotCheckRuleBillSub_Item> ls1 = new List<Model.ClsSc_MouldDotCheckRuleBillSub_Item>();
                ls1 = oListModels.getObjectByJson_Sc_MouldDotCheckRuleBillSub_Item(msg4);
                int j = 0;
                foreach (Model.ClsSc_MouldDotCheckRuleBillSub_Item oItemSub in ls1)
                {
                ////配件项表体数据
                ////按 },{来拆分数组 //去掉【和】
                //msg4 = msg4.Substring(1, msg4.Length - 2);
                //msg4 = msg4.Replace("\\", "");
                //msg4 = msg4.Replace("\n", "");  //\n
                //                                //msg2 = msg2.Replace("'", "’");
                //List<Model.ClsSc_MouldDotCheckRuleBillSub_Item> ls1 = new List<Model.ClsSc_MouldDotCheckRuleBillSub_Item>();
                //ls1 = oListModels.getObjectByJson_Sc_MouldDotCheckRuleBillSub_Item(msg4);
                //int j = 0;
                //foreach (Model.ClsSc_MouldDotCheckRuleBillSub_Item oItemSub in ls1)
                //{
                    j++;
                    oItemSub.HEntryID = j;
                    //oItemSub.HCloseMan = "";       //行关闭
                    oItemSub.HEntryCloseDate = DBUtility.ClsPub.isDate(DateTime.Now);
                    oItemSub.HCloseType = false;   //关闭类型
                //    j++;
                //    oItemSub.HEntryID = j;
                //    //oItemSub.HCloseMan = "";       //行关闭
                //    oItemSub.HEntryCloseDate = DBUtility.ClsPub.isDate(DateTime.Now);
                //    oItemSub.HCloseType = false;   //关闭类型
                    oItemSub.HSourceInterID = 0;     // 源单主内码
                    oItemSub.HSourceEntryID = 0;   //源单子内码
                //    oItemSub.HSourceInterID = 0;     // 源单主内码
                //    oItemSub.HSourceEntryID = 0;   //源单子内码
                    oItemSub.HRelationQty = 0;     //关联数量
                    oBill.DetailColl.Add(oItemSub);
                }
                //    oItemSub.HRelationQty = 0;     //关联数量
                //    oBill.DetailColl.Add(oItemSub);
                //}
                //保存
@@ -255,18 +304,19 @@
                }
                SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
                //获取点检项目编辑数据
                string sql = "select 点检项目ID HDotCheckItemID,点检项目代码 HDotCheckItemNumber,点检项目 HDotCheckItem,点检部位 HDotCheckPart,具体要求 HClaim,负责人ID HManagerID,负责人代码 HManagerNumber,负责人名称 HManagerName,子备注2 HRemark from h_v_Sc_MouldDotCheckRuleBillSub where 1 = 1 " + Swhere + "";
                string sql = "select * from h_v_Sc_MouldDotCheckRuleBillSub where 1 = 1 " + Swhere + "";
                ds = oCN.RunProcReturn(sql, "h_v_Sc_MouldDotCheckRuleBillSub");
                //获取配件项目编辑数据
                string sql1 = "select 配件ID HMaterID,配件代码 HMaterNumber,配件名称 HMaterName,单位ID HUnitID,计量单位代码 HUnitNumber,计量单位名称 HUnitName,用量 HQty,子备注1 HRemark,标准用量 HQtyMust from h_v_Sc_MouldDotCheckRuleBillSub_Item where 1 = 1 " + Swhere + "";
                ds1 = oCN.RunProcReturn(sql1, "h_v_Sc_MouldDotCheckRuleBillSub_Item");
                ////获取配件项目编辑数据
                //string sql1 = "select 配件ID HMaterID,配件代码 HMaterNumber,配件名称 HMaterName,单位ID HUnitID,计量单位代码 HUnitNumber,计量单位名称 HUnitName,用量 HQty,子备注1 HRemark,标准用量 HQtyMust from h_v_Sc_MouldDotCheckRuleBillSub_Item where 1 = 1 " + Swhere + "";
                //ds1 = oCN.RunProcReturn(sql1, "h_v_Sc_MouldDotCheckRuleBillSub_Item");
                list.Add(ds.Tables[0]);
                list.Add(ds1.Tables[0]);
                //list.Add(ds1.Tables[0]);
                objJsonResult.code = "0";
                objJsonResult.count = 1;
                objJsonResult.Message = "获取信息成功!";
                objJsonResult.list = list;
                objJsonResult.data = ds.Tables[0];
            }
            catch (Exception e)
            {
@@ -342,5 +392,44 @@
            }
        }
        #endregion
        #region[器具点检记录表,选点检计划获取点检计划清单信息]
        [Route("Sc_MouldDotCheckPlanBill/Sc_MouldDotCheckPlanBill_PlanList")]
        [HttpGet]
        public object Sc_MouldDotCheckPlanBill_PlanList(string HInterID, string HDate)
        {
            DataSet ds;
            try
            {
                SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
                ds = oCN.RunProcReturn("exec h_p_Sc_MouldDotCheck_GetPlanList " + HInterID + ",'" + HDate + "'", "h_p_Sc_MouldDotCheck_GetPlanList");
                if (ds.Tables[0].Rows.Count != 0 || ds != null)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "获取信息成功!";
                    objJsonResult.data = ds.Tables[0];
                }
                else
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "没有查询到数据信息!";
                    objJsonResult.data = ds.Tables[0];
                }
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "发生异常,没有返回任何计划!" + e.ToString();
                objJsonResult.data = null;
            }
            return objJsonResult;
        }
        #endregion
    }
}