llj
7 天以前 2bf6de5d4748d28f7f3a098af25503d6a0c619d1
WebAPI/Controllers/QC_POStockInCheckBillController.cs
@@ -21,7 +21,7 @@
        public WebServer webserver = new WebServer();
        SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
        public DAL.ClsQC_POStockInCheckBill BillOld = new DAL.ClsQC_POStockInCheckBill();
        Pub_Class.ClsXt_SystemParameter oSystemParameter = new Pub_Class.ClsXt_SystemParameter();
        //DataSet ds;
@@ -103,6 +103,229 @@
            }
        }
        #endregion
        #region 来料检验单根据源单获取信息-源单为生产订单(1102)
        /// <summary>
        ///参数:string sql。
        ///返回值:object。
        /// </summary>
        [Route("QC_POStockInCheckBill/get_POOrderList_Tmp")]
        [HttpGet]
        public object get_POOrderList_Tmp(int HInterID, int HEntryID, string HBillType)
        {
            try
            {
                List<object> columnNameList = new List<object>();
                if (HInterID == 0 || HBillType.Equals(""))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "参数不全,获取源单信息失败!HInterID:" + HInterID + ";HEntryID:" + HEntryID + ";HBillType:" + HBillType + ";";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                string sReturn = "";
                string sql = "";
                if (oSystemParameter.ShowBill(ref sReturn))
                {
                    switch (oSystemParameter.omodel.QC_POStockInCheckBill_QCSchemeSource)
                    {
                        case "物料":
                            sql = "exec h_p_QC_GetInfoByPOOrderBill " + "'物料'" + "," + HInterID + "," + HEntryID + "," + HBillType;
                            break;
                    }
                }
                ds = oCN.RunProcReturn(sql, "h_p_QC_GetInfoByPOOrderBill");
                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 来料检验单根据源单获取信息-源单为收料通知单(1103)
        /// <summary>
        ///参数:string sql。
        ///返回值:object。
        /// </summary>
        [Route("QC_POStockInCheckBill/get_POInStockBill_Tmp")]
        [HttpGet]
        public object get_POInStockBill_Tmp(int HInterID, int HEntryID, string HBillType)
        {
            try
            {
                List<object> columnNameList = new List<object>();
                if (HInterID == 0 || HBillType.Equals(""))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "参数不全,获取源单信息失败!HInterID:" + HInterID + ";HEntryID:" + HEntryID + ";HBillType:" + HBillType + ";";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                string sReturn = "";
                string sql = "";
                if (oSystemParameter.ShowBill(ref sReturn))
                {
                    switch (oSystemParameter.omodel.QC_POStockInCheckBill_QCSchemeSource)
                    {
                        case "物料":
                            sql = "exec h_p_QC_GetInfoByPOInStockBill " + "'物料'" + "," + HInterID + "," + HEntryID + "," + HBillType;
                            break;
                    }
                }
                ds = oCN.RunProcReturn(sql, "h_p_QC_GetInfoByPOInStockBill");
                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 来料检验单根据源单获取信息-源单为采购入库单(1201)
        /// <summary>
        ///参数:string sql。
        ///返回值:object。
        /// </summary>
        [Route("QC_POStockInCheckBill/get_Kf_POStockInBill_Tmp")]
        [HttpGet]
        public object get_Kf_POStockInBill_Tmp(int HInterID, int HEntryID, string HBillType)
        {
            try
            {
                List<object> columnNameList = new List<object>();
                if (HInterID == 0 || HBillType.Equals(""))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "参数不全,获取源单信息失败!HInterID:" + HInterID + ";HEntryID:" + HEntryID + ";HBillType:" + HBillType + ";";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                string sReturn = "";
                string sql = "";
                if (oSystemParameter.ShowBill(ref sReturn))
                {
                    switch (oSystemParameter.omodel.QC_POStockInCheckBill_QCSchemeSource)
                    {
                        case "物料":
                            sql = "exec h_p_QC_GetInfoByKfPOStockInBill " + "'物料'" + "," + HInterID + "," + HEntryID + "," + HBillType;
                            break;
                    }
                }
                ds = oCN.RunProcReturn(sql, "h_p_QC_GetInfoByKfPOStockInBill");
                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 [返回检验值列表]
        /// <summary>
@@ -812,7 +1035,7 @@
                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);
                List<Model.ClsQC_POStockInCheckBillSub> subList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsQC_POStockInCheckBillSub>>(msg3);
                BillNew.DetailColl = new List<Model.ClsQC_POStockInCheckBillSub>();
@@ -820,6 +1043,7 @@
                {
                    if (i >= 0)//HQty
                    {
                        LogService.Write(subList[i]);
                        Model.ClsQC_POStockInCheckBillSub oSub = new Model.ClsQC_POStockInCheckBillSub();
                        oSub.HEntryID = i + 1;
                        oSub.HRemark = ClsPub.isStrNull(subList[i].HRemark);
@@ -860,6 +1084,10 @@
                        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.HCompareSymbol = DBUtility.ClsPub.isStrNull(subList[i].HCompareSymbol);
                        oSub.HQualityStdID = DBUtility.ClsPub.isLong(subList[i].HQualityStdID);
                        oSub.HInspectMethodID = DBUtility.ClsPub.isLong(subList[i].HInspectMethodID);
                        oSub.HInspectBasisID = DBUtility.ClsPub.isLong(subList[i].HInspectBasisID);
                        BillNew.DetailColl.Add(oSub);
                    }
                    else
@@ -874,7 +1102,7 @@
                //保存完毕后处理
                if (OperationType.Equals("1") || OperationType.Equals("2"))