llj
21 小时以前 a91fdba94705dd25cecccc7a4a5dcc2b3f2c09a6
WebAPI/Controllers/SCGL/QC_OutCompCheckBillController.cs
@@ -262,6 +262,15 @@
            string OperationType = sArray[2].ToString();
            string user = sArray[3].ToString();
            string Value = sArray[4].ToString();
            string BadReason = null;
            if(sArray.Length > 4)
            {
                BadReason = sArray[5].ToString();
            }
            if (String.IsNullOrWhiteSpace(BadReason) == true)
            {
                BadReason = "[]";
            }
            bool bResult;
            try
            {
@@ -325,8 +334,11 @@
                BillNew.omodel.HBatchNo = ClsPub.isStrNull(mainList[0].HBatchNo);
                BillNew.omodel.HTakeSampleCheckBillID = ClsPub.isLong(mainList[0].HTakeSampleCheckBillID);
                BillNew.omodel.HTakeSampleCheckBillNo = ClsPub.isStrNull(mainList[0].HTakeSampleCheckBillNo);
                BillNew.omodel.HRemarkSN = ClsPub.isStrNull(mainList[0].HRemarkSN);
                BillNew.omodel.HCheckQty = mainList[0].HCheckQty;
                List<Model.ClsQC_OutCompCheckBillSub> subList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsQC_OutCompCheckBillSub>>(msg3);
                List<Model.ClsQC_POStockInCheckBillSub_BadReason> badReasonList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsQC_POStockInCheckBillSub_BadReason>>(BadReason);
                BillNew.DetailColl = new List<Model.ClsQC_OutCompCheckBillSub>();
                for (int i = 0; i < subList.ToArray().Length; i++)
@@ -378,6 +390,7 @@
                        oSub.HInspectMethodID = DBUtility.ClsPub.isLong(subList[i].HInspectMethodID);//检验方法
                        oSub.HInspectBasisID = DBUtility.ClsPub.isLong(subList[i].HInspectBasisID);//检验依据
                        oSub.HCompareSymbol = DBUtility.ClsPub.isStrNull(subList[i].HCompareSymbol);//比较符
                        oSub.HInspectValQ = subList[i].HInspectValQ;
                        BillNew.DetailColl.Add(oSub);
                    }
@@ -388,6 +401,25 @@
                        objJsonResult.Message = "无明细行信息!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                }
                for (int i = 0; i < badReasonList.ToArray().Length; i++)
                {
                    if (i >= 0)//HQty
                    {
                        Model.ClsQC_OutCompCheckBillSub_BadReason oSub = new Model.ClsQC_OutCompCheckBillSub_BadReason();
                        oSub.HInterID = mainList[0].HInterID;
                        oSub.HEntryID = i + 1;
                        oSub.HRemark = ClsPub.isStrNull(subList[i].HRemark);
                        oSub.HCloseMan = DBUtility.ClsPub.isStrNull(badReasonList[i].HCloseMan);
                        oSub.HEntryCloseDate = DBUtility.ClsPub.isDate(badReasonList[i].HEntryCloseDate);
                        oSub.HCloseType = DBUtility.ClsPub.isBool(badReasonList[i].HCloseType);
                        oSub.HBillNo_bak = DBUtility.ClsPub.isStrNull(mainList[0].HBillNo);
                        oSub.HQty = badReasonList[i].HQty;
                        oSub.HBadReasonID = badReasonList[i].HBadReasonID;
                        BillNew.DetailCol1_BadReason.Add(oSub);
                    }
                }
@@ -1275,5 +1307,154 @@
            }
        }
        #endregion
        #region 出厂检验单根据源单获取信息-源单为销售订单通过单据号(1401)
        /// <summary>
        ///参数:string sql。
        ///返回值:object。
        /// </summary>
        [Route("QC_OutCompCheckBill/get_SeOrderBill_Tmp_ByBiilNo")]
        [HttpGet]
        public object get_SeOrderBill_Tmp_ByBiilNo(string HBillNo, string user)
        {
            try
            {
                List<object> columnNameList = new List<object>();
                if ( HBillNo.Equals(""))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "参数不全,获取源单信息失败! ";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                string sReturn = "";
                string sql = "";
                if (oSystemParameter.ShowBill(ref sReturn))
                {
                    switch (oSystemParameter.omodel.QC_OutCompCheckBill_QCSchemeSource)
                    {
                        case "物料":
                            sql = "exec h_p_QC_GetInfoBySeOrderBill_ByBillNo " + "'物料'" + ",'" + HBillNo +"'";
                            break;
                    }
                }
                ds = oCN.RunProcReturn(sql, "h_p_QC_GetInfoBySeOrderBill_ByBillNo");
                if (ds == null || ds.Tables[0].Rows.Count == 0)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "没查询到数据!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                else
                {
                    //添加列名
                    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 e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "查询数据异常,请与管理员联系!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
        #region 出厂检验单根据源单获取信息-源单为发货通知单通过单据号(1401)
        /// <summary>
        ///参数:string sql。
        ///返回值:object。
        /// </summary>
        [Route("QC_OutCompCheckBill/get_SeOutStockBill_Tmp_ByBillNo")]
        [HttpGet]
        public object get_SeOutStockBill_Tmp_ByBillNo(string HBillNo, string user)
        {
            try
            {
                List<object> columnNameList = new List<object>();
                if (HBillNo.Equals(""))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "参数不全,获取源单信息失败! ";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                string sReturn = "";
                string sql = "";
                if (oSystemParameter.ShowBill(ref sReturn))
                {
                    switch (oSystemParameter.omodel.QC_OutCompCheckBill_QCSchemeSource)
                    {
                        case "物料":
                            sql = "exec h_p_QC_GetInfoBySeOutStockBill_ByBillNo " + "'物料'" + ",'" + HBillNo + "'";
                            break;
                    }
                }
                ds = oCN.RunProcReturn(sql, "h_p_QC_GetInfoBySeOutStockBill_ByBillNo");
                if (ds == null || ds.Tables[0].Rows.Count == 0)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "没查询到数据!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                else
                {
                    //添加列名
                    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 e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "查询数据异常,请与管理员联系!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
    }
}