yusijie
2023-04-11 09844d2ce0c99bfcf7698581f9393a2ac1fc3e15
WebAPI/Controllers/CJGL/Sc_ProcExchWorkBackBillController.cs
@@ -77,7 +77,7 @@
            {
                SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
                string sql = string.Format(@"select top 2 * from h_v_Sc_ProcessExchangeBillQuerySub");
                ds = oCN.RunProcReturn(sql + sWhere, "h_v_Sc_ProcessExchangeBillQuerySub");
                ds = oCN.RunProcReturn(sql + sWhere + " order by 流水号 ", "h_v_Sc_ProcessExchangeBillQuerySub");
                objJsonResult.code = "0";
                objJsonResult.count = 1;
                objJsonResult.Message = "获取信息成功!";
@@ -145,6 +145,14 @@
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "保存失败!没有单据日期,无法保存!";
                        objJsonResult.data = 1;
                        return objJsonResult;
                    }
                    if (oItem.HChecker != "")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "保存失败!单据已审核,无法保存!";
                        objJsonResult.data = 1;
                        return objJsonResult;
                    }
@@ -341,7 +349,7 @@
                  
                    //审核
                    if (Cj_StationInBillCheckBill(HInterID, CurUserName, ref DBUtility.ClsPub.sExeReturnInfo))
                    if (Cj_StationInBillCheckBill(HInterID,int.Parse( Ds.Tables[0].Rows[0]["HProcExchInterID"].ToString()), CurUserName, ref DBUtility.ClsPub.sExeReturnInfo))
                    {
                        objJsonResult.code = "1";
                        objJsonResult.count = 1;
@@ -379,13 +387,35 @@
        }
        //审核
        public bool Cj_StationInBillCheckBill(Int64 HInterID, string CurUserName, ref string sReturn)
        public bool Cj_StationInBillCheckBill(Int64 HInterID,int HProcExchInterID, string CurUserName, ref string sReturn)
        {
            try
            {
                oCN.BeginTran();
                oCN.RunProc(" Update Sc_ProcExchWorkBackBillMain set HChecker='" + CurUserName + "',HBillStatus=2,HCheckDate='getdate()' Where HInterID=" + HInterID.ToString());
                oCN.RunProc(" Update Sc_ProcExchWorkBackBillMain set HChecker='" + CurUserName + "',HBillStatus=2,HCheckDate=getdate() Where HInterID=" + HInterID.ToString());
                //回填工序流转卡
                oCN.RunProc("exec h_p_ProcExchWorkBackBill_Check_In " + HInterID.ToString());
                oCN.RunProc("exec h_p_Sc_ProcessExchangeBill_SetRemark " + HProcExchInterID.ToString()); //设置 备注 为 工艺流
                oCN.RunProc("exec h_p_Sc_ProcessExchangeBill_SetUpdate " + HProcExchInterID.ToString()); //设置 末道 首道 转 等信息   器具清单  工艺参数清单;
                DataSet ds = new DataSet();
                //设置条码号  回填 领料批次
                ds = oCN.RunProcReturn("exec h_p_Mes_ProcessExchangeBackBarCode " + HProcExchInterID.ToString(), "h_p_Mes_ProcessExchangeBackBarCode");
                if (DBUtility.ClsPub.isLong(ds.Tables[0].Rows[0]["HBack"]) != 0)
                {
                    sReturn = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]).ToString();
                    oCN.RollBack();
                    return false;
                }
                //控制关联数量
                ds = null;
                ds = oCN.RunProcReturn("exec h_p_Sc_ProcessExchangeBill_Checkqty " + HProcExchInterID.ToString(), "h_p_Sc_ProcessExchangeBill_Checkqty");
                if (DBUtility.ClsPub.isLong(ds.Tables[0].Rows[0]["HBack"]) != 0)
                {
                    sReturn = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]).ToString();
                    oCN.RollBack();
                    return false;
                }
                oCN.Commit();
                return true;
            }