yusijie
2023-08-03 0731d102ee6904c8ac6f8fafb09151f8f34c2ad8
WebAPI/Controllers/Æ·ÖʹÜÀí/Ê×¼þ¼ìÑéµ¥/QC_FirstPieceCheckBillController.cs
@@ -120,6 +120,21 @@
                        oSub.HMin = DBUtility.ClsPub.isStrNull(subList[i].HMin);
                        oSub.HAvg = DBUtility.ClsPub.isStrNull(subList[i].HAvg);
                        oSub.HBillNo_bak = DBUtility.ClsPub.isStrNull(mainList[0].HBillNo);
                        oSub.HSampleSchemeID= DBUtility.ClsPub.isLong(subList[i].HSampleSchemeID);
                        oSub.HSampleQty= DBUtility.ClsPub.isLong(subList[i].HSampleQty);
                        oSub.HSampleDamageQty= DBUtility.ClsPub.isDoule(subList[i].HSampleDamageQty);
                        oSub.HAcceptQty= DBUtility.ClsPub.isLong(subList[i].HAcceptQty);
                        oSub.HRejectQty= DBUtility.ClsPub.isLong(subList[i].HRejectQty);
                        oSub.HSampleUnRightQty= DBUtility.ClsPub.isDoule(subList[i].HSampleUnRightQty);
                        oSub.HStatus= DBUtility.ClsPub.isStrNull(subList[i].HStatus);
                        oSub.HUnitID= DBUtility.ClsPub.isLong(subList[i].HUnitID);
                        oSub.HInspectVal= DBUtility.ClsPub.isStrNull(subList[i].HInspectVal);
                        oSub.HTargetVal= DBUtility.ClsPub.isStrNull(subList[i].HTargetVal);
                        oSub.HUpLimit= DBUtility.ClsPub.isStrNull(subList[i].HUpLimit);
                        oSub.HDownLimit= DBUtility.ClsPub.isStrNull(subList[i].HDownLimit);
                        oSub.HUpOffSet= DBUtility.ClsPub.isStrNull(subList[i].HUpOffSet);
                        oSub.HDownOffSet= DBUtility.ClsPub.isStrNull(subList[i].HDownOffSet);
                        BillNew.DetailColl.Add(oSub);
                    }
                    else
@@ -131,34 +146,7 @@
                        return objJsonResult;
                    }
                }
                List<Model.ClsQC_FirstPieceCheckBillSub_ValueGrid> sub_ValueGridList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsQC_FirstPieceCheckBillSub_ValueGrid>>(Value);
                BillNew.DetailColl_Value = new List<Model.ClsQC_FirstPieceCheckBillSub_ValueGrid>();
                for (int i = 0; i < sub_ValueGridList.ToArray().Length; i++)
                {
                    if (i >= 0)//HQty
                    {
                        Model.ClsQC_FirstPieceCheckBillSub_ValueGrid oSub_Value = new Model.ClsQC_FirstPieceCheckBillSub_ValueGrid();
                        oSub_Value.HInterID = mainList[0].HInterID;
                        oSub_Value.HEntryID = i + 1;
                        oSub_Value.HSEQ = i + 1;
                        oSub_Value.HInSpectResult = ClsPub.isStrNull(sub_ValueGridList[i].HInSpectResult);
                        oSub_Value.HInSpectValue = ClsPub.isLong(sub_ValueGridList[i].HInSpectValue);
                        oSub_Value.HInSpectValueB = ClsPub.isLong(sub_ValueGridList[i].HInSpectValueB);
                        oSub_Value.HInSpectValueT = ClsPub.isStrNull(sub_ValueGridList[i].HInSpectValueT);
                        BillNew.DetailColl_Value.Add(oSub_Value);
                    }
                    else
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "无明细行信息!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                }
                //保存完毕后处理
                if (OperationType.Equals("1") || OperationType.Equals("2"))
                {
@@ -248,6 +236,128 @@
            }
        }
        #endregion
        //
        #region æ£€éªŒå€¼ä¿å­˜
        [Route("QC_FirstPieceCheckBill/set_SaveValue")]
        [HttpPost]
        public object set_SaveValue([FromBody] JObject msg)
        {
            ListModels oListModels = new ListModels();
            try
            {
                var _value = msg["msg"].ToString();
                string msg1 = _value.ToString();
                string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
                string Value = sArray[0].ToString(); //检验值表格
                Int64 HInterID = Convert.ToInt64(sArray[1]); //主ID
                Int64 HEntryID = Convert.ToInt64(sArray[2]); //子ID
                bool bResult;
                List<Model.ClsQC_FirstPieceCheckBillSub_ValueGrid> valueList = new List<Model.ClsQC_FirstPieceCheckBillSub_ValueGrid>();
                valueList = oListModels.getObjectByJson_ClsClsQC_FirstPieceCheckBillSub_ValueGrid(Value);
                DAL.ClsQC_FirstPieceCheckBill BillNew = new DAL.ClsQC_FirstPieceCheckBill();
                for (int i = 0; i < valueList.ToArray().Length; i++)
                {
                    if (i >= 0)//HQty
                    {
                        Model.ClsQC_FirstPieceCheckBillSub_ValueGrid oSub_Value = new Model.ClsQC_FirstPieceCheckBillSub_ValueGrid();
                        oSub_Value.HInterID = HInterID;
                        oSub_Value.HEntryID = HEntryID;
                        oSub_Value.HSEQ = i + 1;
                        oSub_Value.HInSpectResult = ClsPub.isStrNull(valueList[i].HInSpectResult);
                        oSub_Value.HInSpectValue = ClsPub.isLong(valueList[i].HInSpectValue);
                        oSub_Value.HInSpectValueB = ClsPub.isLong(valueList[i].HInSpectValueB);
                        oSub_Value.HInSpectValueT = ClsPub.isStrNull(valueList[i].HInSpectValueT);
                        BillNew.DetailColl_Value.Add(oSub_Value);
                    }
                    else
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "无明细行信息!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                }
                bResult = BillNew.AddValue(ref ClsPub.sExeReturnInfo, ref HInterID, ref HEntryID);
                if (bResult == true)
                {
                    objJsonResult.code = "1";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "保存检验值成功";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                else
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "保存失败!原因:" + ClsPub.sExeReturnInfo;
                    objJsonResult.data = null;
                    return objJsonResult;
                }
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "Exception!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
        /// <summary>
        ///返回检验值列表
        /// </summary>
        /// <param name="sWhere"></param>
        /// <returns></returns>
        [Route("QC_ValueTable/getValueList")]
        [HttpGet]
        public object getValueList(Int64 HInterID, Int64 HEntryID, string user)
        {
            DataSet ds;
            try
            {
                SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
                ds = oCN.RunProcReturn("select * from QC_FirstPieceCheckBillSub_ValueGrid  where  HInterID="+ HInterID + " and HEntryID="+ HEntryID, "h_v_QC_FirstPieceCheckBillList");
                if (ds.Tables[0].Rows.Count > 0)
                {
                    objJsonResult.code = "1";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "Sucess!";
                    objJsonResult.data = ds.Tables[0];
                    return objJsonResult;
                }
                else
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "没有查询到数据!";
                    objJsonResult.data = ds.Tables[0];
                    return objJsonResult;
                }
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "没有返回任何记录!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
    }
}