llj
2 天以前 1c90213ebd42e2d00324a71a67a60d07e4c8a7da
WebAPI/Controllers/Sc_MouldRepairInBillListController.cs
@@ -4550,7 +4550,7 @@
            if (string.IsNullOrEmpty(HID))
                return new ApiResult<DataSet> { code = -1, msg = "ID不能为空" };
            SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
            var dataSet = oCN.RunProcReturn("select top 1 * from h_v_Sc_MouldRepairWorkBillList_Edit  where hmainid= " + HID + " ", "h_v_Sc_MouldRepairWorkBillList_Edit");
            var dataSet = oCN.RunProcReturn("select top 1 * from h_v_Sc_MouldRepairWorkBillList_Edit where hmainid= " + HID + " ", "h_v_Sc_MouldRepairWorkBillList_Edit");
            if (dataSet == null || dataSet.Tables[0].Rows.Count == 0)
                return new ApiResult<DataSet> { code = -1, msg = "不存在维修单号" };
            return new ApiResult<DataSet> { code = 1, msg = "查询成功", data = dataSet };
@@ -5365,12 +5365,66 @@
        #region 器具维修记录统计分析 
        /// <summary>
        /// 器具维修记录统计分析 列表
        /// 器具维修记录统计分析 列表 (年月)
        ///参数:string sql。
        ///返回值:object。
        /// </summary>
        [Route("Sb_MouldRepairWorkBill/Sb_MouldRepairWorkBill")]
        [HttpGet]
        public object Sb_MouldRepairWorkBill_Expand1(string DateYear,string HType, string user ,string DateMonth = "-1")
        {
            if(DateMonth == "-1" || DateMonth == "" || DateMonth == null)
            {
                return Sb_MouldRepairWorkBill(DateYear, HType, user);
            }
            try
            {
                List<object> columnNameList = new List<object>();
                if (DateYear == null || DateYear.Equals(""))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "请选择有效年份";
                    return objJsonResult;
                }
                else
                {
                    ds = oCN.RunProcReturn("exec h_p_Sb_MouldRepairWorkBill_ExpendMonth'" + DateYear + "','" + HType + "'", "h_p_Sb_MouldRepairWorkBill");
                }
                //添加列名
                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;
            }
        }
        /// <summary>
        /// 器具维修记录统计分析 列表 (年份)
        ///参数:string sql。
        ///返回值:object。
        /// </summary>
        public object Sb_MouldRepairWorkBill(string DateYear, string HType, string user)
        {
            try
@@ -8561,7 +8615,7 @@
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                DAL.ClsSc_MouldDotCheckBill oBill = new DAL.ClsSc_MouldDotCheckBill();
                List<Model.ClsSc_MouldDotCheckBillMain> lsmain = new List<Model.ClsSc_MouldDotCheckBillMain>();
                msg2 = msg2.Replace("\\", "");
@@ -8576,6 +8630,8 @@
                    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);
                    if (DBUtility.ClsPub.isStrNull(oItem.HDate) == "")
                    {
@@ -8586,6 +8642,21 @@
                        return objJsonResult;
                    }
                    oBill.omodel = oItem;
                    LogService.Write("Insert Into Sc_MouldDotCheckBillMain " +
                "(HBillType,HBillSubType,HInterID,HBillNo,HDate,HMaker,HMakeDate" +
                ",HYear,HPeriod,HRemark" +
                ",HMouldID,HBeginDate" +
                ",HEndDate,HPlanNo,HPlanInterID" +
                ",HInnerBillNo,HExplanation,HMouldDotCheckRuleID" +
                ",HLastResult,HErrNote,HBigSafeNote,HShiftsID,HDotCheckNote" +
                ") " +
                " values('" + oBill.BillType + "','" + oBill.HBillSubType + "'," + oBill.omodel.HInterID.ToString() + ",'" + oBill.omodel.HBillNo + "','" + oBill.omodel.HDate + "','" + oBill.omodel.HMaker + "',getdate()" +
                "," + oBill.omodel.HYear.ToString() + "," + oBill.omodel.HPeriod.ToString() + ",'" + oBill.omodel.HRemark + "'" +
                "," + oBill.omodel.HMouldID.ToString() + ",'" + oBill.omodel.HBeginDate + "'" +
                ",'" + oBill.omodel.HEndDate + "','" + oBill.omodel.HPlanNo + "'," + oBill.omodel.HPlanInterID.ToString() +
                ",'" + oBill.omodel.HInnerBillNo + "','" + oBill.omodel.HExplanation + "','" + oBill.omodel.HMouldDotCheckRuleID + "','" + oBill.omodel.HLastResult + "','" + oBill.omodel.HErrNote + "','" + oBill.omodel.HBigSafeNote + "'," + oBill.omodel.HShiftsID + ",'" + oBill.omodel.HDotCheckNote + "'" +
                ") ");
                }
                //表体数据
                //按 },{来拆分数组 //去掉【和】
@@ -8611,9 +8682,21 @@
                    oBill.DetailColl.Add(oItemSub);
                    LogService.Write("Insert into Sc_MouldDotCheckBillSub " +
                      " (HInterID,HEntryID" +
                      ",HManagerID" +
                      ",HDotCheckItemID,HDotCheckItem,HDotCheckPart,HClaim" +
                      ",HCloseMan,HCloseType,HRemark" +
                      ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" +
                      ",HDotCheckItemClassID,HDotCheckItemMethodID,HDotCheckResult" +
                      ") values("
                      + oBill.omodel.HInterID.ToString() + "," + oItemSub.HEntryID.ToString() +
                      "," + oItemSub.HManagerID.ToString() + "," + oItemSub.HDotCheckItemID.ToString() +
                      ",'" + oItemSub.HDotCheckItem + "','" + oItemSub.HDotCheckPart + "','" + oItemSub.HClaim + "'" +
                      ",'" + oItemSub.HCloseMan + "'," + Convert.ToString(oItemSub.HCloseType ? 1 : 0) + ",'" + oItemSub.HRemark + "'" +
                      "," + oItemSub.HSourceInterID.ToString() + "," + oItemSub.HSourceEntryID.ToString() + ",'" + oItemSub.HSourceBillNo + "','" + oItemSub.HSourceBillType + "'," + oItemSub.HRelationQty.ToString() + "," + oItemSub.HRelationMoney.ToString() + "," + oItemSub.HDotCheckItemClassID + "," + oItemSub.HDotCheckItemMethodID + ",'" + oItemSub.HDotCheckResult + "'" +
                      ") ");
                }
                //保存
                //保存完毕后处理