jhz
2022-07-26 1f49f98a07ae1c31a1967c5c36b382d6c855becd
WebAPI/Controllers/»ù´¡×ÊÁÏ/»ù´¡×ÊÁÏ/Gy_StockCheckItemBillController.cs
@@ -211,7 +211,7 @@
                    ")", ref DBUtility.ClsPub.sExeReturnInfo);
                    //修改上级为非末级代码
                    oCn.RunProc("Update Gy_StockCheckItem set HEndflag=0 where HItemID=" + oBill.HParentID, ref DBUtility.ClsPub.sExeReturnInfo);
                    objJsonResult.code = "0";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "保存成功!";
@@ -252,6 +252,46 @@
        }
        #endregion
        #region ç›˜ç‚¹åˆ†æžåˆ—表判断当前选择的盘点方案是否生成过单据
        [Route("Gy_StockCheckItemBill/StockItemSubIsExistence")]
        [HttpGet]
        public object StockItemSubIsExistence(string sID)
        {
            try
            {
                DataSet ds;
                SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
                string sql;
                sql = string.Format(@"select * from Gy_StockCheckItemSub where HInterID=" + sID);
                ds = oCN.RunProcReturn(sql, "Gy_StockCheckItemSub");
                if (ds.Tables[0].Rows.Count == 0)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "暂未生成";
                    return objJsonResult;
                }
                else
                {
                    objJsonResult.code = "1";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "已生成";
                    return objJsonResult;
                }
            }
            catch (Exception ex)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "查询数据异常,请与管理员联系!" + ex.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
        #region ç›˜ç‚¹åˆ†æžåˆ—表
        [Route("Gy_StockCheckItemBill/Get_InventoryAnalysisList")]
        [HttpGet]
@@ -263,15 +303,30 @@
            try
            {
                SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
                if (sID == null || sID == "")
                //判断是否选择盘点方案,是=>(用盘点方案子表做对比),否=>(用器具档案做对比)
                if (sID==null|| sID == "")
                {
                    sql = string.Format(@"select * from h_v_Sc_MouldInventoryAnalysisList where " + sWhere + " order by HItemID desc ");
                    if (sWhere=="pk")
                    {
                        sql = string.Format(@"select * from h_v_Sc_MouldInventoryAnalysisPK");
                    }
                    else
                    {
                        sql = string.Format($"exec h_p_Sc_MouldInventoryAnalysisList2  '{sWhere}'");
                    }
                }
                else
                {
                    sql = string.Format(@"select * from h_v_Sc_MouldInventoryAnalysisList where " + sWhere + " and HSourceInterID=(select HItemID from Gy_StockCheckItem where HItemID=" + sID + ") and HMakeDate<=(select HEndDate from Gy_StockCheckItem where HItemID=" + sID + ") order by HItemID desc ");
                    if (sWhere == "pk")
                    {
                        sql = string.Format(@"select * from h_v_Sc_MouldInventoryAnalysisPK2 WHERE HInterID="+ sID);
                    }
                    else
                    {
                        sql = string.Format($"exec h_p_Sc_MouldInventoryAnalysisList  '{sID}','{sWhere}'");
                    }
                }
                ds = oCN.RunProcReturn(sql, "Sc_MouldStockBillMain_Temp");
                ds = oCN.RunProcReturn(sql, "h_p_Sc_MouldInventoryAnalysisList");
                list.Add(ds.Tables[0]);
                objJsonResult.code = "1";
@@ -406,6 +461,7 @@
                {
                    var HBarCode = item.HBarCode;
                    var HItemID = item.HItemID;
                    string HDate = item.HMakeDate;
                    string HBillNo = "";
                    Int64 HInterID = 0;//显示的字段
                    DataSet ds1 = new DataSet();
@@ -422,7 +478,7 @@
                    ",HSupID,HSupTypeID,HWHID,HSCWHID,HEmpID,HManagerID,HSecManagerID" +
                    ",HKeeperID,HDeptID,HInnerBillNo,HRedBlueFlag" +
                    ") " +
                    " values('3814','3814'," + HInterID + ",'" + HBillNo + "','2022-01-02'" +
                    " values('3814','3814'," + HInterID + ",'" + HBillNo + "','" + HDate+"'"+
                    ", '" + user + "',getdate()" +
                    ", " + dr["HSupID"].ToString() + ", 1," + dr["HNowSupID"].ToString() + ",0,0,0,0" +
                    ", 0," + dr["HDeptID"].ToString() + ",' ',0" +
@@ -490,10 +546,11 @@
                    var HBarCode = item.HBarCode;
                    var HItemID = item.HItemID;
                    string HBillNo = "";
                    string HDate = item.HMakeDate;
                    Int64 HInterID = 0;//显示的字段
                    DataSet ds1 = new DataSet();
                    ds = oCn.RunProcReturn("select * from Gy_MouldFileMain where HBarCode='W11201609050013'", "Gy_MouldFileMain");
                    ds1 = oCn.RunProcReturn("select top 1 * from Sc_MouldStockBillMain_Temp where HBarCode='W11201609050013' and HItemID='38'", "Sc_MouldStockBillMain_Temp");
                    ds = oCn.RunProcReturn("select * from Gy_MouldFileMain where HBarCode='" + HBarCode + "'", "Gy_MouldFileMain");
                    ds1 = oCn.RunProcReturn("select top 1 * from Sc_MouldStockBillMain_Temp where HBarCode='" + HBarCode + "' and HItemID='" + HItemID + "'", "Sc_MouldStockBillMain_Temp");
                    DataRow dr = ds.Tables[0].Rows[0];
                    DataRow dr1 = ds1.Tables[0].Rows[0];
                    HInterID = DBUtility.ClsPub.CreateBillID("3827", ref DBUtility.ClsPub.sExeReturnInfo);
@@ -504,7 +561,7 @@
                    ",HSupID,HSupTypeID,HWHID,HSCWHID,HEmpID,HManagerID,HSecManagerID" +
                    ",HKeeperID,HDeptID,HInnerBillNo,HRedBlueFlag" +
                    ") " +
                    " values('3827','3827'," + HInterID + ",'" + HBillNo + "','2022-01-02'" +
                    " values('3827','3827'," + HInterID + ",'" + HBillNo + "','" + HDate + "'" +
                    ", '" + user + "',getdate()" +
                    ", " + dr1["HCorrespondentID"].ToString() + "," + dr1["HCorrespondentTypeID"].ToString() + ",isnull('" + dr["HNowSupID"].ToString() + "',0),0,0,0,0" +
                    ", 0," + dr["HDeptID"].ToString() + ",'',0" +
@@ -572,6 +629,7 @@
                    var HBarCode = item.HBarCode;
                    var HItemID = item.HItemID;
                    string HBillNo = "";
                    string HDate = item.HMakeDate;
                    Int64 HInterID = 0;//显示的字段
                    DataSet ds1 = new DataSet();
                    ds = oCn.RunProcReturn("select * from Gy_MouldFileMain where HBarCode='" + HBarCode + "'", "Gy_MouldFileMain");
@@ -587,7 +645,7 @@
                    ",HSupID,HSupTypeID,HWHID,HSCWHID,HEmpID,HManagerID,HSecManagerID" +
                    ",HKeeperID,HDeptID,HInnerBillNo,HRedBlueFlag" +
                    ") " +
                    " values('3832','3832'," + HInterID + ",'" + HBillNo + "','2022-01-02'" +
                    " values('3832','3832'," + HInterID + ",'" + HBillNo + "','" + HDate + "'" +
                    ", '" + user + "',getdate()" +
                    ", " + dr1["HCorrespondentID"].ToString() + "," + dr1["HCorrespondentTypeID"].ToString() + "," + dr["HNowSupID"].ToString() + ",0,0,0,0" +
                    ", 0," + dr["HDeptID"].ToString() + ",' ',0" +
@@ -653,6 +711,7 @@
                    var HBarCode = item.HBarCode;
                    var HItemID = item.HItemID;
                    string HBillNo = "";
                    string HDate = item.HMakeDate;
                    Int64 HInterID = 0;//显示的字段
                    DataSet ds1 = new DataSet();
                    ds = oCn.RunProcReturn("select * from Gy_MouldFileMain where HBarCode='" + HBarCode + "'", "Gy_MouldFileMain");
@@ -668,7 +727,7 @@
                    ",HSupID,HSupTypeID,HWHID,HSCWHID,HEmpID,HManagerID,HSecManagerID" +
                    ",HKeeperID,HDeptID,HInnerBillNo,HRedBlueFlag" +
                    ") " +
                    " values('3802','3802'," + HInterID + ",'" + HBillNo + "','2022-01-02'" +
                    " values('3802','3802'," + HInterID + ",'" + HBillNo + "','" + HDate + "'" +
                    ", '" + user + "',getdate()" +
                    ", " + dr1["HCorrespondentID"].ToString() + "," + dr1["HCorrespondentTypeID"].ToString() + "," + dr["HNowSupID"].ToString() + ",0,0,0,0" +
                    ", 0," + dr["HDeptID"].ToString() + ",' ',0" +
@@ -733,6 +792,7 @@
                    var HBarCode = item.HBarCode;
                    var HItemID = item.HItemID;
                    string HBillNo = "";
                    string HDate = item.HMakeDate;
                    Int64 HInterID = 0;//显示的字段
                    DataSet ds1 = new DataSet();
                    ds = oCn.RunProcReturn("select * from Gy_MouldFileMain where HBarCode='" + HBarCode + "'", "Gy_MouldFileMain");
@@ -748,7 +808,7 @@
                    ",HSupID,HSupTypeID,HWHID,HSCWHID,HEmpID,HManagerID,HSecManagerID" +
                    ",HKeeperID,HDeptID,HInnerBillNo,HRedBlueFlag" +
                    ") " +
                    " values('3803','3803'," + HInterID + ",'" + HBillNo + "','2022-01-02'" +
                    " values('3803','3803'," + HInterID + ",'" + HBillNo + "','" + HDate + "'" +
                    ", '" + user + "',getdate()" +
                    ", " + dr["HNowSupID"].ToString() + "," + dr["HNowSupTypeID"].ToString() + "," + dr["HNowSupID"].ToString() + ",0,0,0,0" +
                    ", 0," + dr["HDeptID"].ToString() + ",' ',0" +