chenhaozhe
4 天以前 b4cae676b169c4894cfe30ac6a18462dbd3af13e
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
            {
@@ -299,6 +308,7 @@
                BillNew.omodel.HBillNo = mainList[0].HBillNo;//递入type得到的单据号
                BillNew.omodel.HDate = HDate;
                BillNew.omodel.HRemark = mainList[0].HRemark;//备注
                BillNew.omodel.HRemarkSN = mainList[0].HRemarkSN;//SN备注
                BillNew.omodel.HMaker = mainList[0].HMaker;
                BillNew.omodel.HSourceID = ClsPub.isLong(mainList[0].HSourceID);
                BillNew.omodel.HICMOInterID = ClsPub.isLong(mainList[0].HICMOInterID);
@@ -326,6 +336,8 @@
                BillNew.omodel.HTakeSampleCheckBillNo = ClsPub.isStrNull(mainList[0].HTakeSampleCheckBillNo);
                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++)
@@ -372,6 +384,12 @@
                        oSub.HKeyInspect = DBUtility.ClsPub.isLong(subList[i].HKeyInspect);
                        oSub.HInspectInstruMentID = DBUtility.ClsPub.isLong(subList[i].HInspectInstruMentID);
                        oSub.HInspectResult = DBUtility.ClsPub.isStrNull(subList[i].HResult);
                        oSub.HQualityStdID = DBUtility.ClsPub.isLong(subList[i].HQualityStdID);//质量标准
                        oSub.HInspectMethodID = DBUtility.ClsPub.isLong(subList[i].HInspectMethodID);//检验方法
                        oSub.HInspectBasisID = DBUtility.ClsPub.isLong(subList[i].HInspectBasisID);//检验依据
                        oSub.HCompareSymbol = DBUtility.ClsPub.isStrNull(subList[i].HCompareSymbol);//比较符
                        BillNew.DetailColl.Add(oSub);
                    }
                    else
@@ -381,6 +399,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);
                    }
                }
@@ -1268,5 +1305,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
    }
}