1
duhe
2024-04-16 f5b17648645b4bddfd64c471158f2c8f8b172083
1
23个文件已修改
6个文件已添加
3350 ■■■■ 已修改文件
DAL/DAL.csproj 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DAL/仓库管理/ClsSc_ProductionReturnBill.cs 722 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DAL/质检管理/ClsQC_NoPassProdConclusionBill.cs 304 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Model/Model.csproj 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Model/仓库管理/ClsSc_ProductionReturnBillMain.cs 24 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Model/仓库管理/ClsSc_ProductionReturnBillSub.cs 35 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Model/质检管理/ClsQC_NoPassProdConclusionBillMain.cs 30 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Model/质检管理/ClsQC_NoPassProdConclusionBillSub.cs 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Model/采购管理/ClsCg_POInStockBillMain.cs 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Model/采购管理/ClsCg_POOrderBillMain.cs 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Model/采购管理/ClsCg_POOrderBillSub.cs 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WarM/条码打印/Gy_BarCodeBill.cs 62 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Controllers/BLL/Xt_UserController.cs 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Controllers/CGGL/Cg_POInStockBillController.cs 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Controllers/CGGL/Cg_POOrderBillController.cs 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Controllers/CGGL/Kf_POStockInBillController.cs 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Controllers/SCGL/Sc_MESTransFerWorkBillController.cs 342 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Controllers/SCGL/Sc_ProductionReturnBillController.cs 810 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Controllers/Sc_ProcessMangementController.cs 855 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Controllers/WebAPIController.cs 49 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/DLL/ClsGy_Material_Ctl.cs 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/DLL/ClsOA_ErrMsgBackBill.cs 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/ListModels.cs 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Models/ClsGy_Material_Model.cs 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Models/ClsKf_ICStockBillMain.cs 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Models/ClsKf_ICStockBillSub.cs 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Models/ClsOA_ErrMsgBackBillMain.cs 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Models/Gy_User.cs 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Web.config 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DAL/DAL.csproj
@@ -90,6 +90,7 @@
    <Compile Include="MES\ClsSc_MESMaterToSourceBill .cs" />
    <Compile Include="人事管理\ClsHR_EmpFosterBill.cs" />
    <Compile Include="人事管理\ClsHR_EmpUpChangeBill.cs" />
    <Compile Include="仓库管理\ClsSc_ProductionReturnBill.cs" />
    <Compile Include="仓库管理\ClsKf_StepFoldInBill.cs" />
    <Compile Include="仓库管理\ClsKf_StepFoldOutBill.cs" />
    <Compile Include="仓库管理\ClsKf_SellOutBillForLayUI.cs" />
@@ -644,6 +645,7 @@
    <Compile Include="系统公用\ClsXt_SystemParameter_Ctl.cs" />
    <Compile Include="系统公用\ClsXt_BillSubType_Ctl.cs" />
    <Compile Include="计划管理\ClsGy_MaterialTechParamBillMain.cs" />
    <Compile Include="质检管理\ClsQC_NoPassProdConclusionBill.cs" />
    <Compile Include="质检管理\ClsQC_NoPassProdDisposeCheckBill.cs" />
    <Compile Include="质检管理\ClsQC_NoPassProdDisposeBill.cs" />
    <Compile Include="质检管理\ClsQC_NoPassProdRequestBill.cs" />
DAL/²Ö¿â¹ÜÀí/ClsSc_ProductionReturnBill.cs
New file
@@ -0,0 +1,722 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
namespace DAL
{
    public class ClsSc_ProductionReturnBill : DBUtility.ClsXt_BaseBill
    {
        public Model.ClsSc_ProductionReturnBillMain omodel = new Model.ClsSc_ProductionReturnBillMain();
        public List<Model.ClsKf_ProductInBillSub> DetailColl = new List<Model.ClsKf_ProductInBillSub>();
        public ClsSc_ProductionReturnBill()
        {
            base.MvarItemKeyForWeb = "h_v_Kf_ProductInBillMain_ForWeb";
            base.MvarItemKeySubForWeb = "h_v_Kf_ProductInBillSub_ForWeb";
            base.MvarItemKeySub = "Kf_ICStockBillSub";
            base.MvarItemKeySub2 = "";
            base.MvarItemKeySub3 = "";
            base.MvarItemKeySub4 = "";
            base.MvarItemKey = "Kf_ICStockBillMain";
            base.MvarReportTitle = "产品退库单";
            base.BillType = "1245";
            base.HBillSubType = "1245";
        }
        #region å›ºå®šä»£ç 
        ~ClsSc_ProductionReturnBill()
        {
            DetailColl = null;
        }
        #endregion   è‡ªå®šä¹‰æ–¹æ³•
        //修改单据
        public override bool ModifyBill(Int64 lngBillKey, ref string sReturn)
        {
            try
            {
                //
                oCn.BeginTran();
                //更新主表
                oCn.RunProc("UpDate Kf_ICStockBillMain set  " +
                " HBillNo='" + omodel.HBillNo + "'" +  //固定赋值===============
                ",HDate='" + omodel.HDate + "'" +
                ",HYear='" + omodel.HYear.ToString() + "'" +
                ",HPeriod='" + omodel.HPeriod.ToString() + "'" +
                ",HRemark='" + omodel.HRemark + "'" +
                ",HUpDater='" + DBUtility.ClsPub.CurUserName + "'" +
                ",HUpDateDate=getdate()" +
                    //========================================
                ",HSupID=" + omodel.HSupID.ToString() +
                ",HWHID=" + omodel.HWHID.ToString() +
                ",HSCWHID=" + omodel.HSCWHID.ToString() +
                ",HEmpID=" + omodel.HEmpID.ToString() +
                ",HManagerID=" + omodel.HManagerID.ToString() +
                ",HSecManagerID=" + omodel.HSecManagerID.ToString() +
                ",HKeeperID=" + omodel.HKeeperID.ToString() +
                ",HDeptID=" + omodel.HDeptID.ToString() +
                ",HExplanation='" + omodel.HExplanation + "'" +
                ",HInnerBillNo='" + omodel.HInnerBillNo + "'" +
                ",HRedBlueFlag=" + DBUtility.ClsPub.BoolToString(omodel.HRedBlueFlag) +
                " where HInterID=" + lngBillKey.ToString());
                //删除关联
                DeleteRelation(ref sReturn, lngBillKey);
                //删除子表
                DeleteBillSub(lngBillKey);
                //插入子表
                omodel.HInterID = lngBillKey;
                foreach (Model.ClsKf_ProductInBillSub oSub in DetailColl)
                {
                    oCn.RunProc("Insert into Kf_ICStockBillSub " +
                      " (HInterID,HEntryID,HCloseMan,HEntryCloseDate,HCloseType,HRemark" +
                      ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" +
                      ",HMaterID,HPropertyID,HSecUnitID,HSecUnitRate,HUnitID,HQtyMust" +
                      ",HQty,HPrice,HMoney,HWHID,HSCWHID,HSPID" +
                      ",HEngineNum,HUnderPanNum,HLeaveFactCard" +
                      ",HSCSPID,HSPGroupID,HBatchNo,HPOOrderInterID,HPOOrderEntryID,HPOOrderBillNo" +
                      ",HSeOrderInterID,HSeOrderEntryID,HSeOrderBillNo" +
                      ") values("
                      + omodel.HInterID.ToString() + "," + oSub.HEntryID.ToString() + ",'" + oSub.HCloseMan + "','" + oSub.HEntryCloseDate.ToShortDateString() + "'," + Convert.ToString(oSub.HCloseType ? 1 : 0) + ",'" + oSub.HRemark + "'" +
                      "," + oSub.HSourceInterID.ToString() + "," + oSub.HSourceEntryID.ToString() + ",'" + oSub.HSourceBillNo + "','" + oSub.HSourceBillType + "'," + oSub.HRelationQty.ToString() + "," + oSub.HRelationMoney.ToString() +
                      "," + oSub.HMaterID.ToString() + "," + oSub.HPropertyID.ToString() + "," + oSub.HSecUnitID.ToString() + "," + oSub.HSecUnitRate.ToString() + "," + oSub.HUnitID.ToString() + "," + oSub.HQtyMust.ToString() +
                      "," + oSub.HQty.ToString() + "," + oSub.HPrice.ToString() + "," + oSub.HMoney.ToString() + "," + oSub.HWHID.ToString() + "," + oSub.HSCWHID.ToString() + "," + oSub.HSPID.ToString() +
                      ",'" + oSub.HEngineNum + "','" + oSub.HUnderPanNum + "','" + oSub.HLeaveFactCard + "'" +
                      "," + oSub.HSCSPID.ToString() + "," + oSub.HSPGroupID.ToString() + ",'" + oSub.HBatchNo + "'," + oSub.HPOOrderInterID.ToString() + "," + oSub.HPOOrderEntryID.ToString() + ",'" + oSub.HPOOrderBillNo + "'" +
                      "," + oSub.HSeOrderInterID.ToString() + "," + oSub.HSeOrderEntryID.ToString() + ",'" + oSub.HSeOrderBillNo + "'" +
                      ") ");
                }
                //
                //foreach (Model.ClsKf_ProductInBillSub oSub in DetailColl)
                //{
                //    Ds = oCn.RunProcReturn("exec h_p_Kf_ProductInBill_Qty " + oSub.HICMOInterID, "");
                //    if (Ds.Tables[0].Rows.Count == 0)
                //        return;
                //    if (DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBool"]) == "Y")
                //    {
                //        sReturn = "汇报数量超过计划数量!不允许保存";
                //        return false;
                //    }
                //}
                sReturn = "修改单据成功!";
                oCn.Commit();
                return true;
            }
            catch (Exception e)
            {
                sReturn = e.Message;
                oCn.RollBack();
                throw (e);
            }
        }
        //新增单据
        public override bool AddBill(ref string sReturn)
        {
            try
            {
                //得到mainid
                omodel.HInterID = DBUtility.ClsPub.CreateBillID(BillType, ref DBUtility.ClsPub.sExeReturnInfo);
                //若MAINDI重复则重新获取
                oCn.BeginTran();
                //主表
                oCn.RunProc("Insert Into Kf_ICStockBillMain   " +
                "(HBillType,HBillSubType,HInterID,HBillNo,HDate" +
                ",HYear,HPeriod,HRemark,HMaker,HMakeDate" +
                ",HSupID,HWHID,HSCWHID,HEmpID,HManagerID,HSecManagerID" +
                ",HKeeperID,HDeptID,HExplanation,HInnerBillNo,HRedBlueFlag" +
                ") " +
                " values('" + this.BillType + "','" + this.HBillSubType + "'," + omodel.HInterID.ToString() + ",'" + omodel.HBillNo + "','" + omodel.HDate + "'" +
                ", " + omodel.HYear.ToString() + "," + omodel.HPeriod.ToString() + ",'" + omodel.HRemark + "','" + DBUtility.ClsPub.CurUserName + "',getdate()" +
                ", " + omodel.HSupID.ToString() + "," + omodel.HWHID.ToString() + "," + omodel.HSCWHID.ToString() + "," + omodel.HEmpID.ToString() + "," + omodel.HManagerID.ToString() + "," + omodel.HSecManagerID.ToString() +
                ", " + omodel.HKeeperID.ToString() + "," + omodel.HDeptID.ToString() + ",'" + omodel.HExplanation + "','" + omodel.HInnerBillNo + "'," + DBUtility.ClsPub.BoolToString(omodel.HRedBlueFlag) +
                ") ");
                //插入子表
                foreach (Model.ClsKf_ProductInBillSub oSub in DetailColl)
                {
                    oCn.RunProc("Insert into Kf_ICStockBillSub " +
                      " (HInterID,HEntryID,HCloseMan,HEntryCloseDate,HCloseType,HRemark" +
                      ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" +
                      ",HMaterID,HPropertyID,HSecUnitID,HSecUnitRate,HUnitID,HQtyMust" +
                      ",HQty,HPrice,HMoney,HWHID,HSCWHID,HSPID" +
                      ",HEngineNum,HUnderPanNum,HLeaveFactCard" +
                      ",HSCSPID,HSPGroupID,HBatchNo,HPOOrderInterID,HPOOrderEntryID,HPOOrderBillNo" +
                      ",HSeOrderInterID,HSeOrderEntryID,HSeOrderBillNo" +
                      ") values("
                      + omodel.HInterID.ToString() + "," + oSub.HEntryID.ToString() + ",'" + oSub.HCloseMan + "','" + oSub.HEntryCloseDate.ToShortDateString() + "'," + Convert.ToString(oSub.HCloseType ? 1 : 0) + ",'" + oSub.HRemark + "'" +
                      "," + oSub.HSourceInterID.ToString() + "," + oSub.HSourceEntryID.ToString() + ",'" + oSub.HSourceBillNo + "','" + oSub.HSourceBillType + "'," + oSub.HRelationQty.ToString() + "," + oSub.HRelationMoney.ToString() +
                      "," + oSub.HMaterID.ToString() + "," + oSub.HPropertyID.ToString() + "," + oSub.HSecUnitID.ToString() + "," + oSub.HSecUnitRate.ToString() + "," + oSub.HUnitID.ToString() + "," + oSub.HQtyMust.ToString() +
                      "," + oSub.HQty.ToString() + "," + oSub.HPrice.ToString() + "," + oSub.HMoney.ToString() + "," + oSub.HWHID.ToString() + "," + oSub.HSCWHID.ToString() + "," + oSub.HSPID.ToString() +
                      ",'" + oSub.HEngineNum + "','" + oSub.HUnderPanNum + "','" + oSub.HLeaveFactCard + "'" +
                      "," + oSub.HSCSPID.ToString() + "," + oSub.HSPGroupID.ToString() + ",'" + oSub.HBatchNo + "'," + oSub.HPOOrderInterID.ToString() + "," + oSub.HPOOrderEntryID.ToString() + ",'" + oSub.HPOOrderBillNo + "'" +
                      "," + oSub.HSeOrderInterID.ToString() + "," + oSub.HSeOrderEntryID.ToString() + ",'" + oSub.HSeOrderBillNo + "'" +
                      ") ");
                }
                //
                //foreach (Model.ClsKf_ProductInBillSub oSub in DetailColl)
                //{
                //    Ds = oCn.RunProcReturn("exec h_p_Kf_ProductInBill_Qty " + oSub.HICMOInterID, "");
                //    if (Ds.Tables[0].Rows.Count == 0)
                //        return;
                //    if (DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBool"]) == "Y")
                //    {
                //        sReturn = "汇报数量超过计划数量!不允许保存";
                //        return false;
                //    }
                //}
                //
                sReturn = "新增单据成功!";
                oCn.Commit();
                return true;
            }
            catch (Exception e)
            {
                sReturn = e.Message;
                oCn.RollBack();
                throw (e);
            }
        }
        //显示单据
        public override bool ShowBill(Int64 lngBillKey, ref string sReturn)
        {
            try
            {
                //查询主表
                DataSet Ds;
                Ds = oCn.RunProcReturn("Select * from Kf_ICStockBillMain Where HInterID=" + lngBillKey.ToString(), "Kf_ICStockBillMain");
                if (Ds.Tables[0].Rows.Count == 0)
                {
                    sReturn = "单据未找到!";
                    return false;
                }
                //固定赋值===========================================
                omodel.HYear = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HYear"]);
                omodel.HPeriod = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HPeriod"]);
                omodel.HBillType = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBillType"]);
                omodel.HBillSubType = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBillSubType"]);
                omodel.HInterID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HInterID"]);
                omodel.HDate = DBUtility.ClsPub.isDate(Ds.Tables[0].Rows[0]["HDate"]);
                omodel.HBillNo = Ds.Tables[0].Rows[0]["HBillNo"].ToString().Trim();
                omodel.HBillStatus = DBUtility.ClsPub.isInt(Ds.Tables[0].Rows[0]["HBillStatus"]);
                omodel.HCheckItemNowID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HCheckItemNowID"]);
                omodel.HCheckItemNextID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HCheckItemNextID"]);
                omodel.HCheckFlowID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HCheckFlowID"]);
                omodel.HRemark = Ds.Tables[0].Rows[0]["HRemark"].ToString().Trim();
                omodel.HBackDate = Ds.Tables[0].Rows[0]["HBackDate"].ToString().Trim();
                omodel.HBacker = Ds.Tables[0].Rows[0]["HBacker"].ToString().Trim();
                omodel.HCheckDate = Ds.Tables[0].Rows[0]["HCheckDate"].ToString().Trim();
                omodel.HChecker = Ds.Tables[0].Rows[0]["HChecker"].ToString().Trim();
                omodel.HMaker = Ds.Tables[0].Rows[0]["HMaker"].ToString().Trim();
                omodel.HMakeDate = Ds.Tables[0].Rows[0]["HMakeDate"].ToString().Trim();
                omodel.HUpDateDate = Ds.Tables[0].Rows[0]["HUpDateDate"].ToString().Trim();
                omodel.HUpDater = Ds.Tables[0].Rows[0]["HUpDater"].ToString().Trim();
                omodel.HCloseDate = Ds.Tables[0].Rows[0]["HCloseDate"].ToString().Trim();
                omodel.HCloseMan = Ds.Tables[0].Rows[0]["HCloseMan"].ToString().Trim();
                omodel.HCloseType = DBUtility.ClsPub.isBool(Ds.Tables[0].Rows[0]["HCloseType"]);
                omodel.HDeleteDate = Ds.Tables[0].Rows[0]["HDeleteDate"].ToString().Trim();
                omodel.HDeleteMan = Ds.Tables[0].Rows[0]["HDeleteMan"].ToString().Trim();
                //========================================================
                omodel.HSupID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HSupID"]);
                omodel.HWHID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HWHID"]);
                omodel.HSCWHID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HSCWHID"]);
                omodel.HEmpID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HEmpID"]);
                omodel.HManagerID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HManagerID"]);
                omodel.HSecManagerID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HSecManagerID"]);
                omodel.HKeeperID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HKeeperID"]);
                omodel.HDeptID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HDeptID"]);
                omodel.HExplanation = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HExplanation"]);
                omodel.HInnerBillNo = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HInnerBillNo"]);
                omodel.HRedBlueFlag = DBUtility.ClsPub.isBool(Ds.Tables[0].Rows[0]["HRedBlueFlag"]);
                //
                //循环
                DataSet DsSub;
                DsSub = oCn.RunProcReturn("Select * from Kf_ICStockBillSub Where HInterID=" + lngBillKey.ToString(), "Kf_ICStockBillSub");
                DetailColl.Clear();//清空
                for (int i = 0; i < DsSub.Tables[0].Rows.Count; i++)
                {
                    Model.ClsKf_ProductInBillSub oSub = new Model.ClsKf_ProductInBillSub();
                    // å›ºå®šèµ‹å€¼===============================================
                    oSub.HInterID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HInterID"]);
                    oSub.HEntryID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HEntryID"]);
                    oSub.HSourceInterID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSourceInterID"]);
                    oSub.HSourceEntryID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSourceEntryID"]);
                    oSub.HSourceBillType = DsSub.Tables[0].Rows[i]["HSourceBillType"].ToString().Trim();
                    oSub.HSourceBillNo = DsSub.Tables[0].Rows[i]["HSourceBillNo"].ToString().Trim();
                    oSub.HRelationQty = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HRelationQty"]);
                    oSub.HRelationMoney = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HRelationMoney"]);
                    oSub.HCloseMan = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HCloseMan"]);
                    oSub.HCloseType = DBUtility.ClsPub.isBool(DsSub.Tables[0].Rows[i]["HCloseType"]);
                    oSub.HEntryCloseDate = DBUtility.ClsPub.isDate(DsSub.Tables[0].Rows[i]["HEntryCloseDate"]);
                    oSub.HRemark = DsSub.Tables[0].Rows[i]["HRemark"].ToString().Trim();
                    //===================================================
                    oSub.HMaterID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HMaterID"]);
                    oSub.HPropertyID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HPropertyID"]);
                    oSub.HSecUnitID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSecUnitID"]);
                    oSub.HSecUnitRate = DBUtility.ClsPub.isSingle(DsSub.Tables[0].Rows[i]["HSecUnitRate"]);
                    oSub.HUnitID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HUnitID"]);
                    oSub.HQtyMust = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HQtyMust"]);
                    oSub.HQty = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HQty"]);
                    oSub.HPrice = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HPrice"]);
                    oSub.HMoney = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HMoney"]);
                    oSub.HWHID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HWHID"]);
                    oSub.HSCWHID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSCWHID"]);
                    oSub.HSPID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSPID"]);
                    oSub.HSCSPID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSCSPID"]);
                    oSub.HSPGroupID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSPGroupID"]);
                    oSub.HBatchNo = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HBatchNo"]);
                    oSub.HEngineNum = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HEngineNum"]);
                    oSub.HUnderPanNum = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HUnderPanNum"]);
                    oSub.HLeaveFactCard = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HLeaveFactCard"]);
                    oSub.HPOOrderInterID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HPOOrderInterID"]);
                    oSub.HPOOrderEntryID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HPOOrderEntryID"]);
                    oSub.HPOOrderBillNo = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HPOOrderBillNo"]);
                    oSub.HSeOrderInterID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSeOrderInterID"]);
                    oSub.HSeOrderEntryID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSeOrderEntryID"]);
                    oSub.HSeOrderBillNo = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HSeOrderBillNo"]);
                    DetailColl.Add(oSub);
                }
                sReturn = "显示单据成功!";
                return true;
            }
            catch (Exception e)
            {
                sReturn = e.Message;
                throw (e);
            }
        }
        public bool CheckStockQty(long HMaterID, long HWhID, string sBatchNo)
        {
            try
            {
                //查询主表
                DataSet Ds;
                Ds = oCn.RunProcReturn("Select å³æ—¶åº“å­˜ from h_v_KF_ICInventoryList Where HMaterID=" + HMaterID.ToString() + " and HWHID=" + HWhID.ToString() + " and æ‰¹æ¬¡='" + sBatchNo + "'", "h_v_KF_ICInventoryList");
                if (Ds.Tables[0].Rows.Count == 0)
                {
                    return false;
                }
                //判断是否负库存或0库存
                if (DBUtility.ClsPub.isDoule(Ds.Tables[0].Rows[0][0]) <= 0)
                {
                    return false;
                }
                return true;
            }
            catch (Exception e)
            {
                throw (e);
            }
        }
        //条码扫描记录,新增到产品入库   (源单:生产任务单)
        public bool AddBill_PDA(ref string sReturn)
        {
            try
            {
                //判断会计期是否合理
                string s = "";
                int sYear = 0;
                int sPeriod = 0;
                if (DBUtility.Xt_BaseBillFun.Fun_AllowYearPeriod(omodel.HDate, ref sYear, ref sPeriod, ref s) == false)
                {
                    sReturn = s;
                    return false;
                }
                omodel.HYear = sYear;
                omodel.HPeriod = sPeriod;
                DataSet Ds;
                oCn.BeginTran();
                //删除主表
                oCn.RunProc("Delete From Kf_ICStockBillMain  where HInterID=" + omodel.HInterID.ToString());
                //插入子表
                oCn.RunProc("EXEC h_p_Kf_ProductInBillSub_Insert " + omodel.HInterID.ToString() + ",'" + omodel.HBillNo + "'");
                //插入主表
                oCn.RunProc("Insert Into Kf_ICStockBillMain   " +
                "(HBillType,HBillSubType,HInterID,HBillNo,HDate,HMainSourceBillType" +
                ",HYear,HPeriod,HRemark,HMaker,HMakeDate" +
                ",HSupID,HWHID,HSCWHID,HEmpID,HManagerID,HSecManagerID" +
                ",HKeeperID,HDeptID,HExplanation,HInnerBillNo,HRedBlueFlag" +
                ") " +
                " values('" + this.BillType + "','" + this.HBillSubType + "'," + omodel.HInterID.ToString() + ",'" + omodel.HBillNo + "',convert(varchar(10),getdate(),120),'" + omodel.HMainSourceBillType + "'" +
                ", " + omodel.HYear.ToString() + "," + omodel.HPeriod.ToString() + ",'" + omodel.HRemark + "','" + omodel.HMaker + "',convert(varchar(10),getdate(),120)" +
                ", " + omodel.HSupID.ToString() + "," + omodel.HWHID.ToString() + "," + omodel.HSCWHID.ToString() + "," + omodel.HEmpID.ToString() + "," + omodel.HManagerID.ToString() + "," + omodel.HSecManagerID.ToString() +
                ", " + omodel.HKeeperID.ToString() + "," + omodel.HDeptID.ToString() + ",'" + omodel.HExplanation + "','" + omodel.HInnerBillNo + "'," + DBUtility.ClsPub.BoolToString(omodel.HRedBlueFlag) +
                ") ");
                //更新关联数量
                oCn.RunProc("exec h_p_Sc_UpDateICMORelation_Add " + omodel.HInterID.ToString());
                //审核单据
                oCn.RunProc("Update Kf_ICStockBillMain Set HChecker='" + omodel.HMaker + "',HCheckDate=convert(varchar(10),getdate(),120),HBillStatus=2 where HInterID= " + omodel.HInterID.ToString());
                //生成K3单据
                //新增子表、主表
                oCn.RunProc("exec h_p_IFK3_ToERP_ProdInBill_Insert " + omodel.HInterID.ToString() + ",'" + omodel.HBillNo + "'," + omodel.HBillerID.ToString());
                //回填关联数量
                oCn.RunProc("exec h_p_IFK3_ToERP_ProdInBill_UpdateBillRelateData " + omodel.HInterID.ToString());
                //审核单据
                oCn.RunProc("exec h_p_IFK3_ToERP_ProdInBill_Check " + omodel.HInterID.ToString() + "," + omodel.HBillerID.ToString());
                //更新库存
                oCn.RunProc("exec h_p_IFK3_ToERP_ProdInBill_UpdateStock " + omodel.HInterID.ToString());
                oCn.RunProc("exec h_p_IFK3_ToERP_ProdInBill_UpdateOrderStock " + omodel.HInterID.ToString());
                sReturn = "新增单据成功!";
                oCn.Commit();
                return true;
            }
            catch (Exception e)
            {
                sReturn = e.Message;
                oCn.RollBack();
                throw (e);
            }
        }
        //条码扫描记录,新增到产品入库 (红字)
        public bool AddBill_PDA_Red(ref string sReturn)
        {
            try
            {
                //判断会计期是否合理
                string s = "";
                int sYear = 0;
                int sPeriod = 0;
                if (DBUtility.Xt_BaseBillFun.Fun_AllowYearPeriod(omodel.HDate, ref sYear, ref sPeriod, ref s) == false)
                {
                    sReturn = s;
                    return false;
                }
                omodel.HYear = sYear;
                omodel.HPeriod = sPeriod;
                DataSet Ds;
                oCn.BeginTran();
                //删除主表
                oCn.RunProc("Delete From Kf_ICStockBillMain  where HInterID=" + omodel.HInterID.ToString());
                //插入子表
                oCn.RunProc("EXEC h_p_Kf_ProductInBillSub_Red_Insert " + omodel.HInterID.ToString() + ",'" + omodel.HBillNo + "'");
                //插入主表
                oCn.RunProc("Insert Into Kf_ICStockBillMain   " +
                "(HBillType,HBillSubType,HInterID,HBillNo,HDate,HMainSourceBillType" +
                ",HYear,HPeriod,HRemark,HMaker,HMakeDate" +
                ",HSupID,HWHID,HSCWHID,HEmpID,HManagerID,HSecManagerID" +
                ",HKeeperID,HDeptID,HExplanation,HInnerBillNo,HRedBlueFlag" +
                ") " +
                " values('" + this.BillType + "','" + this.HBillSubType + "'," + omodel.HInterID.ToString() + ",'" + omodel.HBillNo + "',convert(varchar(10),getdate(),120),'" + omodel.HMainSourceBillType + "'" +
                ", " + omodel.HYear.ToString() + "," + omodel.HPeriod.ToString() + ",'" + omodel.HRemark + "','" + omodel.HMaker + "',convert(varchar(10),getdate(),120)" +
                ", " + omodel.HSupID.ToString() + "," + omodel.HWHID.ToString() + "," + omodel.HSCWHID.ToString() + "," + omodel.HEmpID.ToString() + "," + omodel.HManagerID.ToString() + "," + omodel.HSecManagerID.ToString() +
                ", " + omodel.HKeeperID.ToString() + "," + omodel.HDeptID.ToString() + ",'" + omodel.HExplanation + "','" + omodel.HInnerBillNo + "'," + DBUtility.ClsPub.BoolToString(omodel.HRedBlueFlag) +
                ") ");
                //更新关联数量
                oCn.RunProc("exec h_p_Cg_UpDateProductInRelation_Red_Add " + omodel.HInterID.ToString());
                //审核单据
                oCn.RunProc("Update Kf_ICStockBillMain Set HChecker='" + omodel.HMaker + "',HCheckDate=convert(varchar(10),getdate(),120),HBillStatus=2 where HInterID= " + omodel.HInterID.ToString());
                //判断条码库存是否异常(负库存、库存大于条码初始化)
                Ds = oCn.RunProcReturn("EXEC h_p_KF_ICInventoryBarCodeQtyCtrl  " + omodel.HInterID.ToString(), "h_p_KF_ICInventoryBarCodeQtyCtrl");
                if (DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0][0]) == 1)
                {
                }
                else
                {
                    sReturn = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0][1]);
                    oCn.RollBack();
                    return false;
                }
                sReturn = "新增单据成功!";
                oCn.Commit();
                return true;
            }
            catch (Exception e)
            {
                sReturn = e.Message;
                oCn.RollBack();
                throw (e);
            }
        }
        public bool AddBill_StationOut_Bad(string sHSourceType, Pub_Class.ClsXt_SystemParameterMain oSystemParameterMain,ref string sErrMsg)
        {
            //上传前必填项判断
            try
            {
                DataSet Ds;
                if (oSystemParameterMain.WMS_CampanyName == "杭州智见" || oSystemParameterMain.WMS_CampanyName == "杭州斯莫尔") //系统参数  å®¢æˆ·å®šåˆ¶åŒ–名称     ç©ºç™½ä¸ºé€šç”¨
                {
                }
                else
                {
                    oCn.BeginTran();
                }
                //生成出入库单据
                //插入子表
                DataSet DS2 = oCn.RunProcReturn("EXEC h_p_Kf_ProductInBillSub_Insert_StationOutBad " + omodel.HInterID.ToString() + ",'" + omodel.HBillNo + "','" + sHSourceType + "'", "h_p_Kf_ProductInBillSub_Insert_StationOutBad");
                if (DS2 == null || DS2.Tables[0].Rows.Count == 0)
                {
                    sErrMsg = "判断写入子表状态失败,未知错误!";
                    if (oSystemParameterMain.WMS_CampanyName == "杭州智见" || oSystemParameterMain.WMS_CampanyName == "杭州斯莫尔") //系统参数  å®¢æˆ·å®šåˆ¶åŒ–名称     ç©ºç™½ä¸ºé€šç”¨
                    {
                    }
                    else
                    {
                        oCn.RollBack();
                    }
                    return false;
                }
                else
                {
                    if (DBUtility.ClsPub.isStrNull(DS2.Tables[0].Rows[0][0]) != "OK")
                    {
                        sErrMsg = "单据号:" + omodel.HBillNo + ",写入子表失败!";
                        return false;
                    }
                }
                        //插入主表
                oCn.RunProc("Insert Into Kf_ICStockBillMain   " +
                "(HBillType,HBillSubType,HInterID,HBillNo,HDate,HMainSourceBillType" +
                ",HYear,HPeriod,HRemark,HMaker,HMakeDate" +
                ",HSupID,HWHID,HSCWHID,HEmpID,HManagerID,HSecManagerID" +
                ",HKeeperID,HDeptID,HExplanation,HInnerBillNo,HRedBlueFlag" +
                ") " +
                " values('1202','1202'," + omodel.HInterID.ToString() + ",'" + omodel.HBillNo + "',convert(varchar(10),getdate(),120),'" + omodel.HMainSourceBillType + "'" +
                ", " + omodel.HYear.ToString() + "," + omodel.HPeriod.ToString() + ",'" + omodel.HRemark + "','" + omodel.HMaker + "',convert(varchar(10),getdate(),120)" +
                ", " + omodel.HSupID.ToString() + "," + omodel.HWHID.ToString() + "," + omodel.HSCWHID.ToString() + "," + omodel.HEmpID.ToString() + "," + omodel.HManagerID.ToString() + "," + omodel.HSecManagerID.ToString() +
                ", " + omodel.HKeeperID.ToString() + "," + omodel.HDeptID.ToString() + ",'" + omodel.HExplanation + "','" + omodel.HInnerBillNo + "'," + DBUtility.ClsPub.BoolToString(omodel.HRedBlueFlag) +
                ") ");
                //新增K3子表、主表
                oCn.RunProc("exec h_p_IFK3_ToERP_ProductInBill_Insert_New " + omodel.HInterID.ToString() + ",'" + omodel.HBillNo + "'," + omodel.HBillerID.ToString() + ",'" + sHSourceType + "'");
                //更新关联数量
                if (sHSourceType == "3710")         //生产任务单
                {
                    oCn.RunProc("exec h_p_Sc_UpDateRelation_ICMOToProductIn_Add " + omodel.HInterID.ToString());
                    //回填K3关联数量
                    oCn.RunProc("exec h_p_IFK3_ToERP_ProductInBill_UpdateBillRelateData_ICMO_New " + omodel.HInterID.ToString());
                }
                else    //无源单
                {
                    //回填K3关联数量
                    oCn.RunProc("exec h_p_IFK3_ToERP_ProductInBill_UpdateBillRelateData_New " + omodel.HInterID.ToString());
                }
                //判断库存更新控制状态(0为审核改变库存,1为保存改变库存)
                DataSet DS = oCn.RunProcReturn("exec h_p_IFK3_SaveUpdateStock ", "h_p_IFK3_SaveUpdateStock");
                if (DS == null || DS.Tables[1].Rows.Count == 0)
                {
                    sErrMsg = "判断库存更新控制状态,未知错误!";
                    if (oSystemParameterMain.WMS_CampanyName == "杭州智见" || oSystemParameterMain.WMS_CampanyName == "杭州斯莫尔") //系统参数  å®¢æˆ·å®šåˆ¶åŒ–名称     ç©ºç™½ä¸ºé€šç”¨
                    {
                    }
                    else
                    {
                        oCn.RollBack();
                    }
                    return false;
                }
                else
                {
                    if (DBUtility.ClsPub.isLong(DS.Tables[1].Rows[0][0]) == 1)
                    {
                        //更新K3库存
                        oCn.RunProc("exec h_p_IFK3_ToERP_ProductInBill_UpdateStock_New " + omodel.HInterID.ToString());
                        oCn.RunProc("exec h_p_IFK3_ToERP_ProductInBill_UpdateOrderStock_New " + omodel.HInterID.ToString());
                        //审核单据
                        if (oSystemParameterMain.Kf_ProductInBill_AutoCheck == "Y") //系统参数  è‡ªåŠ¨å®¡æ ¸
                        {
                            //审核单据
                            oCn.RunProc("Update Kf_ICStockBillMain Set HChecker='" + omodel.HMaker + "',HCheckDate=convert(varchar(10),getdate(),120) where HInterID= " + omodel.HInterID.ToString());
                            //审核K3单据
                            oCn.RunProc("exec h_p_IFK3_ToERP_ProductInBill_Check_New " + omodel.HInterID.ToString() + "," + omodel.HBillerID.ToString());
                        }
                    }
                    else
                    {
                        //审核单据
                        if (oSystemParameterMain.Kf_ProductInBill_AutoCheck == "Y") //系统参数  è‡ªåŠ¨å®¡æ ¸
                        {
                            //审核单据
                            oCn.RunProc("Update Kf_ICStockBillMain Set HChecker='" + omodel.HMaker + "',HCheckDate=convert(varchar(10),getdate(),120) where HInterID= " + omodel.HInterID.ToString());
                            //审核K3单据
                            oCn.RunProc("exec h_p_IFK3_ToERP_ProductInBill_Check_New " + omodel.HInterID.ToString() + "," + omodel.HBillerID.ToString());
                            //更新K3库存
                            oCn.RunProc("exec h_p_IFK3_ToERP_ProductInBill_UpdateStock_New " + omodel.HInterID.ToString());
                            oCn.RunProc("exec h_p_IFK3_ToERP_ProductInBill_UpdateOrderStock_New " + omodel.HInterID.ToString());
                        }
                    }
                }
                sErrMsg = "新增单据成功!";
                if (oSystemParameterMain.WMS_CampanyName == "杭州智见" || oSystemParameterMain.WMS_CampanyName == "杭州斯莫尔") //系统参数  å®¢æˆ·å®šåˆ¶åŒ–名称     ç©ºç™½ä¸ºé€šç”¨
                {
                }
                else
                {
                    oCn.Commit();
                }
                return true;
            }
            catch (Exception e)
            {
                sErrMsg = "生成产品入库单失败!" + e.Message;
                if (oSystemParameterMain.WMS_CampanyName == "杭州智见" || oSystemParameterMain.WMS_CampanyName == "杭州斯莫尔") //系统参数  å®¢æˆ·å®šåˆ¶åŒ–名称     ç©ºç™½ä¸ºé€šç”¨
                {
                }
                else
                {
                    oCn.RollBack();
                }
                return false;
            }
        }
        //末道工序出站汇报单列表   å…¥åº“功能调用
        public bool AddBill_StationOut_LastProc(string sHSourceType, Pub_Class.ClsXt_SystemParameterMain oSystemParameterMain, ref string sErrMsg)
        {
            try
            {
                DataSet Ds;
                if (oSystemParameterMain.WMS_CampanyName == "杭州智见" || oSystemParameterMain.WMS_CampanyName == "杭州斯莫尔") //系统参数  å®¢æˆ·å®šåˆ¶åŒ–名称     ç©ºç™½ä¸ºé€šç”¨
                {
                }
                else
                {
                    oCn.BeginTran();
                }
                //生成出入库单据
                //插入子表
                DataSet DS2 = oCn.RunProcReturn("EXEC h_p_Kf_ProductInBillSub_Insert_StationOutLastProc " + omodel.HInterID.ToString() + ",'" + omodel.HBillNo + "','" + sHSourceType + "'", "h_p_Kf_ProductInBillSub_Insert_StationOutLastProc");
                if (DS2 == null || DS2.Tables[0].Rows.Count == 0)
                {
                    sErrMsg = "判断写入子表状态失败,未知错误!";
                    if (oSystemParameterMain.WMS_CampanyName == "杭州智见" || oSystemParameterMain.WMS_CampanyName == "杭州斯莫尔") //系统参数  å®¢æˆ·å®šåˆ¶åŒ–名称     ç©ºç™½ä¸ºé€šç”¨
                    {
                    }
                    else
                    {
                        oCn.RollBack();
                    }
                    return false;
                }
                else
                {
                    if (DBUtility.ClsPub.isStrNull(DS2.Tables[0].Rows[0][0]) != "OK")
                    {
                        sErrMsg = "单据号:" + omodel.HBillNo + ",写入子表失败!";
                        return false;
                    }
                }
                //插入主表
                oCn.RunProc("Insert Into Kf_ICStockBillMain   " +
                "(HBillType,HBillSubType,HInterID,HBillNo,HDate,HMainSourceBillType" +
                ",HYear,HPeriod,HRemark,HMaker,HMakeDate" +
                ",HSupID,HWHID,HSCWHID,HEmpID,HManagerID,HSecManagerID" +
                ",HKeeperID,HDeptID,HExplanation,HInnerBillNo,HRedBlueFlag" +
                ") " +
                " values('1202','1202'," + omodel.HInterID.ToString() + ",'" + omodel.HBillNo + "',convert(varchar(10),getdate(),120),'" + omodel.HMainSourceBillType + "'" +
                ", " + omodel.HYear.ToString() + "," + omodel.HPeriod.ToString() + ",'" + omodel.HRemark + "','" + omodel.HMaker + "',convert(varchar(10),getdate(),120)" +
                ", " + omodel.HSupID.ToString() + "," + omodel.HWHID.ToString() + "," + omodel.HSCWHID.ToString() + "," + omodel.HEmpID.ToString() + "," + omodel.HManagerID.ToString() + "," + omodel.HSecManagerID.ToString() +
                ", " + omodel.HKeeperID.ToString() + "," + omodel.HDeptID.ToString() + ",'" + omodel.HExplanation + "','" + omodel.HInnerBillNo + "'," + DBUtility.ClsPub.BoolToString(omodel.HRedBlueFlag) +
                ") ");
                //新增K3子表、主表
                oCn.RunProc("exec h_p_IFK3_ToERP_ProductInBill_Insert_New " + omodel.HInterID.ToString() + ",'" + omodel.HBillNo + "'," + omodel.HBillerID.ToString() + ",'" + sHSourceType + "'");
                //更新关联数量
                if (sHSourceType == "3710")         //生产任务单
                {
                    oCn.RunProc("exec h_p_Sc_UpDateRelation_ICMOToProductIn_Add " + omodel.HInterID.ToString());
                    //回填K3关联数量
                    oCn.RunProc("exec h_p_IFK3_ToERP_ProductInBill_UpdateBillRelateData_ICMO_New " + omodel.HInterID.ToString());
                }
                else    //无源单
                {
                    //回填K3关联数量
                    oCn.RunProc("exec h_p_IFK3_ToERP_ProductInBill_UpdateBillRelateData_New " + omodel.HInterID.ToString());
                }
                //判断库存更新控制状态(0为审核改变库存,1为保存改变库存)
                DataSet DS = oCn.RunProcReturn("exec h_p_IFK3_SaveUpdateStock ", "h_p_IFK3_SaveUpdateStock");
                if (DS == null || DS.Tables[1].Rows.Count == 0)
                {
                    sErrMsg = "判断库存更新控制状态,未知错误!";
                    if (oSystemParameterMain.WMS_CampanyName == "杭州智见" || oSystemParameterMain.WMS_CampanyName == "杭州斯莫尔") //系统参数  å®¢æˆ·å®šåˆ¶åŒ–名称     ç©ºç™½ä¸ºé€šç”¨
                    {
                    }
                    else
                    {
                        oCn.RollBack();
                    }
                    return false;
                }
                else
                {
                    if (DBUtility.ClsPub.isLong(DS.Tables[1].Rows[0][0]) == 1)
                    {
                        //更新K3库存
                        oCn.RunProc("exec h_p_IFK3_ToERP_ProductInBill_UpdateStock_New " + omodel.HInterID.ToString());
                        oCn.RunProc("exec h_p_IFK3_ToERP_ProductInBill_UpdateOrderStock_New " + omodel.HInterID.ToString());
                        //审核单据
                        if (oSystemParameterMain.Kf_ProductInBill_AutoCheck == "Y") //系统参数  è‡ªåŠ¨å®¡æ ¸
                        {
                            //审核单据
                            oCn.RunProc("Update Kf_ICStockBillMain Set HChecker='" + omodel.HMaker + "',HCheckDate=convert(varchar(10),getdate(),120) where HInterID= " + omodel.HInterID.ToString());
                            //审核K3单据
                            oCn.RunProc("exec h_p_IFK3_ToERP_ProductInBill_Check_New " + omodel.HInterID.ToString() + "," + omodel.HBillerID.ToString());
                        }
                    }
                    else
                    {
                        //审核单据
                        if (oSystemParameterMain.Kf_ProductInBill_AutoCheck == "Y") //系统参数  è‡ªåŠ¨å®¡æ ¸
                        {
                            //审核单据
                            oCn.RunProc("Update Kf_ICStockBillMain Set HChecker='" + omodel.HMaker + "',HCheckDate=convert(varchar(10),getdate(),120) where HInterID= " + omodel.HInterID.ToString());
                            //审核K3单据
                            oCn.RunProc("exec h_p_IFK3_ToERP_ProductInBill_Check_New " + omodel.HInterID.ToString() + "," + omodel.HBillerID.ToString());
                            //更新K3库存
                            oCn.RunProc("exec h_p_IFK3_ToERP_ProductInBill_UpdateStock_New " + omodel.HInterID.ToString());
                            oCn.RunProc("exec h_p_IFK3_ToERP_ProductInBill_UpdateOrderStock_New " + omodel.HInterID.ToString());
                        }
                    }
                }
                sErrMsg = "新增单据成功!";
                if (oSystemParameterMain.WMS_CampanyName == "杭州智见" || oSystemParameterMain.WMS_CampanyName == "杭州斯莫尔") //系统参数  å®¢æˆ·å®šåˆ¶åŒ–名称     ç©ºç™½ä¸ºé€šç”¨
                {
                }
                else
                {
                    oCn.Commit();
                }
                return true;
            }
            catch (Exception e)
            {
                sErrMsg = "生成产品入库单失败!" + e.Message;
                if (oSystemParameterMain.WMS_CampanyName == "杭州智见" || oSystemParameterMain.WMS_CampanyName == "杭州斯莫尔") //系统参数  å®¢æˆ·å®šåˆ¶åŒ–名称     ç©ºç™½ä¸ºé€šç”¨
                {
                }
                else
                {
                    oCn.RollBack();
                }
                return false;
            }
        }
    }
}
DAL/Öʼì¹ÜÀí/ClsQC_NoPassProdConclusionBill.cs
New file
@@ -0,0 +1,304 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
namespace DAL
{
    public class ClsQC_NoPassProdConclusionBill : DBUtility.ClsXt_BaseBill
    {
        public Model.ClsQC_NoPassProdConclusionBillMain omodel = new Model.ClsQC_NoPassProdConclusionBillMain();
        public List<Model.ClsQC_NoPassProdConclusionBillSub> DetailColl = new List<Model.ClsQC_NoPassProdConclusionBillSub>();
        public ClsQC_NoPassProdConclusionBill()
        {
            base.MvarItemKeySub = "QC_NoPassProdConclusionBillSub";
            base.MvarItemKeySub2 = "";
            base.MvarItemKeySub3 = "";
            base.MvarItemKeySub4 = "";
            base.MvarItemKey = "QC_NoPassProdConclusionBillMain";
            base.MvarReportTitle = "不合格评审处理单";
            base.BillType = "7513";
            base.HBillSubType = "7513";
        }
        #region å›ºå®šä»£ç 
        ~ClsQC_NoPassProdConclusionBill()
        {
            DetailColl = null;
        }
        #endregion   è‡ªå®šä¹‰æ–¹æ³•
        //修改单据
        public override bool ModifyBill(Int64 lngBillKey, ref string sReturn)
        {
            try
            {
                //保存前控制=========================================
                string HBillNote = "";
                DataSet ds = oCn.RunProcReturn("Exec h_p_QC_NoPassProdConclusionBill_BeforeSaveCtrl " + omodel.HInterID.ToString() + ", '" + omodel.HBillNo + "','" + HBillNote + "',1 ", "h_p_QC_NoPassProdConclusionBill_BeforeSaveCtrl");
                if (ds == null)
                {
                    sReturn = "保存前判断失败!";
                    return false;
                }
                if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0")
                {
                    sReturn = "保存失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                    return false;
                }
                //=========================================================
                //
                oCn.BeginTran();
                //更新主表
                oCn.RunProc("UpDate QC_NoPassProdConclusionBillMain set  " +
                " HBillNo='" + omodel.HBillNo + "'" +  //固定赋值===============
                ",HDate='" + omodel.HDate + "'" +
                ",HYear='" + omodel.HYear.ToString() + "'" +
                ",HPeriod='" + omodel.HPeriod.ToString() + "'" +
                ",HRemark='" + omodel.HRemark + "'" +
                ",HUpDater='" + DBUtility.ClsPub.CurUserName + "'" +
                ",HUpDateDate=getdate()" +
                ",HMainSourceInterID='" + omodel.HMainSourceInterID.ToString() + "'" +
                 ",HMainSourceEntryID='" + omodel.HMainSourceEntryID.ToString() + "'" +
                ",HMainSourceBillNo='" + omodel.HMainSourceBillNo + "'" +
                ",HMainSourceBillType='" + omodel.HMainSourceBillType + "'" +
                //========================================
                ",HDisposeDeptID='" + omodel.HDisposeDeptID.ToString() + "'" +
                ",HDeptID='" + omodel.HDeptID.ToString() + "'" +
                 ",HProcID='" + omodel.HProcID.ToString() + "'" +
                 ",HCheckerResult='" + omodel.HCheckerResult + "'" +
                 ",HBadTypeID='" + omodel.HBadTypeID.ToString() +
                 "',HBadReasonID='" + omodel.HBadReasonID.ToString() +
                 "',HDisposeNote='" + omodel.HDisposeNote + "'" +
                 ",HSendMan='" + omodel.HSendMan + "'" +
                 ",HReceiveMan='" + omodel.HReceiveMan + "'" +
                 ",HCopyMan='" + omodel.HCopyMan + "'" +
                " where HInterID=" + lngBillKey.ToString());
                //删除关联
                DeleteRelation(ref sReturn, lngBillKey);
                //删除子表
                DeleteBillSub(lngBillKey);
                //=========================保存后控制
                DataSet ds2 = oCn.RunProcReturn("Exec h_p_QC_NoPassProdConclusionBill_AfterSaveCtrl " + omodel.HInterID.ToString() + ", '" + omodel.HBillNo + "',1 ", "h_p_QC_NoPassProdConclusionBill_AfterSaveCtrl");
                if (ds2 == null)
                {
                    sReturn = "保存后控制判断失败!";
                    oCn.RollBack();
                    return false;
                }
                if (DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBack"]) != "0")
                {
                    sReturn = "保存失败2!" + DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBackRemark"]);
                    oCn.RollBack();
                    return false;
                }
                //============================
                sReturn = "修改单据成功!";
                oCn.Commit();
                return true;
            }
            catch (Exception e)
            {
                sReturn = e.Message;
                oCn.RollBack();
                throw (e);
            }
        }
        //新增单据
        public override bool AddBill(ref string sReturn)
        {
            try
            {
                //得到mainid
                //omodel.HInterID = DBUtility.ClsPub.CreateBillID(BillType, ref DBUtility.ClsPub.sExeReturnInfo);
                //若MAINDI重复则重新获取
                oCn.BeginTran();
                //保存前控制=========================================
                string HBillNote = "";
                DataSet ds = oCn.RunProcReturn("Exec h_p_QC_NoPassProdConclusionBill_BeforeSaveCtrl " + omodel.HInterID.ToString() + ", '" + omodel.HBillNo + "','" + HBillNote + "',1 ", "h_p_QC_NoPassProdConclusionBill_BeforeSaveCtrl");
                if (ds == null)
                {
                    sReturn = "保存前判断失败!";
                    return false;
                }
                if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0")
                {
                    sReturn = "保存失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                    return false;
                }
                //=========================================================
                string sql = "";
                sql = "Insert Into QC_NoPassProdConclusionBillMain" +
                "(HBillType,HBillSubType,HInterID,HBillNo,HDate,HYear,HPeriod,HRemark,HMaker,HMakeDate,HMainSourceInterID,HMainSourceEntryID,HMainSourceBillNo,HMainSourceBillType," +
                "HSendMan,HReceiveMan,HCopyMan,HDeptID,HProcID,HDisposeDeptID,HBadTypeID,HBadReasonID,HCheckerResult,HDisposeNote) " +
                " values(" +
                "'" + this.BillType +
                "','" + this.HBillSubType +
                "'," + omodel.HInterID.ToString() +
                ",'" + omodel.HBillNo +
                "','" + omodel.HDate +
                "'," + omodel.HYear +
                "," + omodel.HPeriod +
                ",'" + omodel.HRemark +
                "','" + omodel.HMaker +
                "',getdate()" +
                ",'" + omodel.HMainSourceInterID +
                "','" + omodel.HMainSourceEntryID +
                "','" + omodel.HMainSourceBillNo +
                "','" + omodel.HMainSourceBillType +
                "','" + omodel.HSendMan +
                "','" + omodel.HReceiveMan +
                "','" + omodel.HCopyMan +
                "','" + omodel.HDeptID.ToString() +
                "','" + omodel.HProcID.ToString() +
                "','" + omodel.HDisposeDeptID.ToString() +
                "','" + omodel.HBadTypeID.ToString() +
                "','" + omodel.HBadReasonID.ToString() +
                 "','" + omodel.HCheckerResult +
                "','" + omodel.HDisposeNote +
                "') ";
                //主表
                oCn.RunProc(sql);
                //=========================保存后控制
                DataSet ds2 = oCn.RunProcReturn("Exec h_p_QC_NoPassProdConclusionBill_AfterSaveCtrl " + omodel.HInterID.ToString() + ", '" + omodel.HBillNo + "',1 ", "h_p_QC_NoPassProdConclusionBill_AfterSaveCtrl");
                if (ds2 == null)
                {
                    sReturn = "保存后控制判断失败!";
                    oCn.RollBack();
                    return false;
                }
                if (DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBack"]) != "0")
                {
                    sReturn = "保存失败2!" + DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBackRemark"]);
                    oCn.RollBack();
                    return false;
                }
                //============================
                sReturn = "新增单据成功!";
                oCn.Commit();
                return true;
            }
            catch (Exception e)
            {
                sReturn = e.Message;
                oCn.RollBack();
                throw (e);
            }
        }
        //显示单据
        public override bool ShowBill(Int64 lngBillKey, ref string sReturn)
        {
            try
            {
                //查询主表
                DataSet Ds;
                Ds = oCn.RunProcReturn("Select * from QC_NoPassProdConclusionBillMain Where HInterID=" + lngBillKey.ToString(), "QC_NoPassProdConclusionBillMain");
                if (Ds.Tables[0].Rows.Count == 0)
                {
                    sReturn = "单据未找到!";
                    return false;
                }
                //固定赋值===========================================
                omodel.HYear = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HYear"]);
                omodel.HPeriod = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HPeriod"]);
                omodel.HBillType = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBillType"]);
                omodel.HBillSubType = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBillSubType"]);
                omodel.HInterID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HInterID"]);
                omodel.HDate = DBUtility.ClsPub.isDate(Ds.Tables[0].Rows[0]["HDate"]);
                omodel.HBillNo = Ds.Tables[0].Rows[0]["HBillNo"].ToString().Trim();
                omodel.HBillStatus = DBUtility.ClsPub.isInt(Ds.Tables[0].Rows[0]["HBillStatus"]);
                omodel.HCheckItemNowID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HCheckItemNowID"]);
                omodel.HCheckItemNextID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HCheckItemNextID"]);
                omodel.HCheckFlowID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HCheckFlowID"]);
                omodel.HRemark = Ds.Tables[0].Rows[0]["HRemark"].ToString().Trim();
                omodel.HBackDate = Ds.Tables[0].Rows[0]["HBackDate"].ToString().Trim();
                omodel.HBacker = Ds.Tables[0].Rows[0]["HBacker"].ToString().Trim();
                omodel.HCheckDate = Ds.Tables[0].Rows[0]["HCheckDate"].ToString().Trim();
                omodel.HChecker = Ds.Tables[0].Rows[0]["HChecker"].ToString().Trim();
                omodel.HMaker = Ds.Tables[0].Rows[0]["HMaker"].ToString().Trim();
                omodel.HMakeDate = Ds.Tables[0].Rows[0]["HMakeDate"].ToString().Trim();
                omodel.HUpDateDate = Ds.Tables[0].Rows[0]["HUpDateDate"].ToString().Trim();
                omodel.HUpDater = Ds.Tables[0].Rows[0]["HUpDater"].ToString().Trim();
                omodel.HCloseDate = Ds.Tables[0].Rows[0]["HCloseDate"].ToString().Trim();
                omodel.HCloseMan = Ds.Tables[0].Rows[0]["HCloseMan"].ToString().Trim();
                omodel.HCloseType = DBUtility.ClsPub.isBool(Ds.Tables[0].Rows[0]["HCloseType"]);
                omodel.HDeleteDate = Ds.Tables[0].Rows[0]["HDeleteDate"].ToString().Trim();
                omodel.HDeleteMan = Ds.Tables[0].Rows[0]["HDeleteMan"].ToString().Trim();
                //========================================================
                //omodel.HDeptID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HDeptID"]);
                //omodel.HContext = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HContext"]);
                //omodel.HDescription = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HDescription"]);
                //omodel.HSendMan = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HSendMan"]);
                //omodel.HReceiveMan = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HReceiveMan"]);
                //omodel.HCopyMan = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HCopyMan"]);
                //omodel.HLevel = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HLevel"]);
                //omodel.HReTransmitMan = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HReTransmitMan"]);
                //omodel.HBillTypeName = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBillTypeName"]);
                //omodel.HPlanBillNo = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HPlanBillNo"]);
                //omodel.HMaterName = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HMaterName"]);
                //omodel.HMaterModel = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HMaterModel"]);
                //omodel.HSendType = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HSendType"]);
                //omodel.HHasten = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HHasten"]);
                //omodel.HQty = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HQty"]);
                //
                //循环
                DataSet DsSub;
                DsSub = oCn.RunProcReturn("Select * from QC_NoPassProdConclusionBillSub Where HInterID=" + lngBillKey.ToString() + " order by HEntryID ", "QC_NoPassProdConclusionBillSub");
                DetailColl.Clear();//清空
                for (int i = 0; i < DsSub.Tables[0].Rows.Count; i++)
                {
                    Model.ClsQC_NoPassProdConclusionBillSub oSub = new Model.ClsQC_NoPassProdConclusionBillSub();
                    // å›ºå®šèµ‹å€¼===============================================
                    oSub.HInterID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HInterID"]);
                    oSub.HEntryID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HEntryID"]);
                    oSub.HSourceInterID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSourceInterID"]);
                    oSub.HSourceEntryID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSourceEntryID"]);
                    oSub.HSourceBillType = DsSub.Tables[0].Rows[i]["HSourceBillType"].ToString().Trim();
                    oSub.HSourceBillNo = DsSub.Tables[0].Rows[i]["HSourceBillNo"].ToString().Trim();
                    oSub.HRelationQty = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HRelationQty"]);
                    oSub.HRelationMoney = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HRelationMoney"]);
                    oSub.HCloseMan = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HCloseMan"]);
                    oSub.HCloseType = DBUtility.ClsPub.isBool(DsSub.Tables[0].Rows[i]["HCloseType"]);
                    oSub.HEntryCloseDate = DBUtility.ClsPub.isDate(DsSub.Tables[0].Rows[i]["HEntryCloseDate"]);
                    oSub.HRemark = DsSub.Tables[0].Rows[i]["HRemark"].ToString().Trim();
                    //===================================================
                    //oSub.HDate = DBUtility.ClsPub.isDate(DsSub.Tables[0].Rows[i]["HDate"]);
                    //oSub.HSendStatus = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSendStatus"]);
                    //oSub.HSendMan = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HSendMan"]);
                    //oSub.HDescription = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HDescription"]);
                    DetailColl.Add(oSub);
                }
                sReturn = "显示单据成功!";
                return true;
            }
            catch (Exception e)
            {
                sReturn = e.Message;
                throw (e);
            }
        }
    }
}
Model/Model.csproj
@@ -239,6 +239,8 @@
    <Compile Include="仓库管理\ClsKf_MateOutRequestBillSub.cs" />
    <Compile Include="仓库管理\ClsKF_ChangeBoxBillMain.cs" />
    <Compile Include="仓库管理\ClsKF_ChangeBoxBillSub.cs" />
    <Compile Include="仓库管理\ClsSc_ProductionReturnBillSub.cs" />
    <Compile Include="仓库管理\ClsSc_ProductionReturnBillMain.cs" />
    <Compile Include="仓库管理\ClsKf_StepFoldInBillMain.cs" />
    <Compile Include="仓库管理\ClsKf_StepFoldInBillSub.cs" />
    <Compile Include="仓库管理\ClsKf_StepFoldOutBillSub.cs" />
@@ -638,6 +640,8 @@
    <Compile Include="系统公用\ClsXt_SystemParameter_Model.cs" />
    <Compile Include="计划管理\ClsGy_MaterialTechParamBillSub.cs" />
    <Compile Include="计划管理\ClsGy_MaterialTechParamBillMain.cs" />
    <Compile Include="质检管理\ClsQC_NoPassProdConclusionBillMain.cs" />
    <Compile Include="质检管理\ClsQC_NoPassProdConclusionBillSub.cs" />
    <Compile Include="质检管理\ClsQC_NoPassProdDisposeCheckBillMain.cs" />
    <Compile Include="质检管理\ClsQC_NoPassProdDisposeBillMain.cs" />
    <Compile Include="质检管理\ClsQC_NoPassProdDisposeCheckBillSub.cs" />
Model/²Ö¿â¹ÜÀí/ClsSc_ProductionReturnBillMain.cs
New file
@@ -0,0 +1,24 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Model
{
    public class ClsSc_ProductionReturnBillMain : DBUtility.ClsXt_BaseBillMain
    {
        public string HDateForWeb;
        public Int64 HSupID;//   int                --供应商
        public Int64 HWHID;//    int                 --仓库
        public Int64 HSCWHID;//  int                   --调出仓库
        public Int64 HEmpID;//    int                --业务员
        public Int64 HManagerID;//   int            --负责人
        public Int64 HSecManagerID;//  int           --验收
        public Int64 HKeeperID;//   int             --保管员
        public Int64 HDeptID;//     int             --部门
        public Int64 HCurID;//     int             --币别
        public Single HExRate;//    money                  --汇率  (选择完币别带出)
        public string HExplanation;//   varchar(200)        --ÕªÒª
        public string HInnerBillNo;//  varchar(50)         --内部单据号
        public bool HRedBlueFlag;//  bit            --红蓝单
    }
}
Model/²Ö¿â¹ÜÀí/ClsSc_ProductionReturnBillSub.cs
New file
@@ -0,0 +1,35 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Model
{
    public class ClsSc_ProductionReturnBillSub : DBUtility.ClsXt_BaseBillSub
    {
        public Int64 HMaterID;//     int               --物料ID
        public Int64 HPropertyID;//  int                --辅助属性
        public Int64 HSecUnitID;//   int                --辅助计量单位
        public Single HSecUnitRate;//       money            --换算率
        public Int64 HUnitID;//    int                  --计量单位
        public double HQtyMust;//   dec(18,8)               --应收数量
        public double HQty;//        dec(18,8)              --实收数量
        public double HPrice;//     dec(18,8)               --单价
        public double HMoney;//     dec(18,8)              --金额
        public Int64 HWHID;//      int                  --收料仓库
        public Int64 HSCWHID;//    int                     --调出仓库ID
        public Int64 HSPID;//        int            --仓位ID
        public Int64 HSCSPID;//        int             --调出仓位ID
        public Int64 HSPGroupID;//    int            --仓位组ID(仓库选择完自动带出)
        public string HBatchNo;//    varchar(50)        --批次
        public string HEngineNum;//    varchar(50)        --发动机号
        public string HUnderPanNum;//    varchar(50)        --地盘号
        public string HLeaveFactCard;//    varchar(50)        --出厂证
        public Int64 HPOOrderInterID;//  int              --采购订单主内码
        public Int64 HPOOrderEntryID;//    int            --采购订单子内码
        public string HPOOrderBillNo;//    varchar(50)         --采购订单号
        public Int64 HSeOrderInterID;//   int             --销售订单主内码
        public Int64 HSeOrderEntryID;//      int            --销售订单子内码
        public string HSeOrderBillNo;//    varchar(50)        --销售订单号
    }
}
Model/Öʼì¹ÜÀí/ClsQC_NoPassProdConclusionBillMain.cs
New file
@@ -0,0 +1,30 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Model
{
    public class ClsQC_NoPassProdConclusionBillMain : DBUtility.ClsXt_BaseBillMain
    {
        public int HDeptID;     // è´£ä»»éƒ¨é—¨
        public int HDisposeDeptID;     // å¤„理部门
        public int HProcID;     // è´£ä»»å·¥åº
        public string HCheckerResult;  // åˆ¤å®šç»“论
        public int HBadTypeID;     // ä¸è‰¯ç±»åž‹  ï¼ˆGy_BadType)
        public int HBadReasonID;  //不良原因(Gy_BadReason)
        public string HDisposeNote;     // å¤„理意见详情
        public string HSendMan;  // å‘送人(gy_czygl)
        public string HReceiveMan;    // æŽ¥æ”¶äºº(gy_czygl)
        public string HCopyMan;   // æŠ„送(gy_czygl)
    }
}
Model/Öʼì¹ÜÀí/ClsQC_NoPassProdConclusionBillSub.cs
New file
@@ -0,0 +1,11 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Model
{
    public class ClsQC_NoPassProdConclusionBillSub : DBUtility.ClsXt_BaseBillSub
    {
    }
}
Model/²É¹º¹ÜÀí/ClsCg_POInStockBillMain.cs
@@ -11,12 +11,14 @@
        public Int64 HSupDealerID;//      int                 --经销商
        public Int64 HCurID;//    int                  --币别 (Gy_Currency)
        public Int64 HWHID;//      int     --仓库
        public Int64 HProjectID;//      int   é¡¹ç›®
        public Single HExRate;//    money                  --汇率  (选择完币别带出)
        public Int64 HEmpID;//     int                   --业务员  (Gy_Employee)
        public Int64 HManagerID;//  int                 --主管    (Gy_Employee)
        public Int64 HDeptID;//     int                 --部门    (Gy_Employee)
        public string HExplanation;//  varchar(200)             --ÕªÒª 
        public string HInnerBillNo;//  varchar(50)             --内部单据号
        public string HInvoiceBillNo;//  varchar(50)             --发票编号
        public Int64 HInterID;
Model/²É¹º¹ÜÀí/ClsCg_POOrderBillMain.cs
@@ -38,6 +38,8 @@
        public string HERPBillType;
        public Int64 HPURCHASEORGID;
        public Int64 HOrgID;
        public Int64 HWHID;
        public Int64 HProjectID;
        public Int64 HPURCHASERGROUPID;    //采购组
        public Int64 HPROVIDERID;    //供货方
Model/²É¹º¹ÜÀí/ClsCg_POOrderBillSub.cs
@@ -79,6 +79,7 @@
        public Int64 HVAT;//增值税
        public Int64 HSELLERWITHHOLDING;//卖方代扣代缴
        public Int64 HBUYERWITHHOLDING;//买方代扣代缴
        public Int64 HWHID;//仓库
        public string HMATERIALDESC; //物料说明
    }
}
WarM/ÌõÂë´òÓ¡/Gy_BarCodeBill.cs
@@ -438,6 +438,16 @@
                PrintQtyCtl = oSystemParameter.omodel.BarCode_PrintQtyCtl;
                UpdatePrintQtyCtl = oSystemParameter.omodel.BarCode_UpdatePrintQtyCtl;
            }
            //系统参数,有源单生成条码,生成条码数量可否超源单数量控制(N为不可超源单数量)
            if (SourceQtyCtl == "N")
            {
                //系统参数为不可超源单数量时,再次判断用户权限是否可超源单数量
                //判断权限
                if (ClsPub.Security_Log(ModRightNameSourceQty, 3, false, ClsPub.CurUserName))
                {
                    SourceQtyCtl = "Y";
                }
            }
            cmbHWorksNumber.Items.Clear();
            if (CampanyName == "飞龙") //系统参数  å®¢æˆ·å®šåˆ¶åŒ–名称
@@ -591,16 +601,6 @@
        //单据完整性判断          æœªå®Œæˆ
        private bool Sub_AllowSave()
        {
            //系统参数,有源单生成条码,生成条码数量可否超源单数量控制(N为不可超源单数量)
            if (SourceQtyCtl=="N")
            {
                //系统参数为不可超源单数量时,再次判断用户权限是否可超源单数量
                //判断权限
                if (ClsPub.Security_Log(ModRightNameSourceQty, 3, false, ClsPub.CurUserName))
                {
                    SourceQtyCtl = "Y";
                }
            }
            //明细表是否为零行
            bool b = false;
            for (int i = 0; i < grdMain.RowCount; i++)
@@ -2244,7 +2244,17 @@
            if (cmbSourceBillType.Text.Trim() == "生产订单")
            {
                string sWhere = " and HOrgID =" + HOrgID.ToString();
                string sWhere = "";
                //系统参数,生成条码数量可否超源单数量控制(N为不可超源单数量)
                if (SourceQtyCtl == "N")
                {
                    sWhere = " and HOrgID =" + HOrgID.ToString() + " and ä»»åŠ¡æ•°é‡>0";
                }
                else
                {
                    sWhere = " and HOrgID =" + HOrgID.ToString();
                }
                DAL.Cls_S_IFCLD_ICMOList oIFCLD_ICMOList = new DAL.Cls_S_IFCLD_ICMOList();
                if (oIFCLD_ICMOList.Refresh(sWhere))  //选择原单
                {
@@ -2398,7 +2408,8 @@
                    grdMain.Rows.Add();
                    grdMain.Rows[i].Cells[HTagCol].Value = "*";
                    //得到信息
                    Ds = oCn.RunProcReturn("select * from h_v_IFCLD_ICMOList where hmainid=" + oSelectRow.BillMainID + " and hsubid=" + oSelectRow.BillSubID, "h_v_IFCLD_ICMOList");
                    Ds = oCn.RunProcReturn("exec h_p_Gy_BarCodeBill_ICMOBillList " + oSelectRow.BillMainID.ToString() + "," + oSelectRow.BillSubID.ToString() + ",'" + SourceQtyCtl + "'", "h_p_Gy_BarCodeBill_ICMOBillList");
                    //Ds = oCn.RunProcReturn("select * from h_v_IFCLD_ICMOList where hmainid=" + oSelectRow.BillMainID + " and hsubid=" + oSelectRow.BillSubID, "h_v_IFCLD_ICMOList");
                    //写入信息
                    Sub_WriteInForm(Ds.Tables[0], i);
                }
@@ -3481,15 +3492,32 @@
                if (cmbSourceBillType.Text.Trim() == "生产订单")
                {
                    DAL.Cls_S_IFCLD_ICMOList oIFCLD_ICMOList = new DAL.Cls_S_IFCLD_ICMOList();
                    if (oIFCLD_ICMOList.RefreshBySourceBillNo(" Where å•据号 like '%" + txtHSourceBillNo.Text + "' and HOrgID =" + sHOrgID.ToString()))  //选择原单
                    //系统参数,生成条码数量可否超源单数量控制(N为不可超源单数量)
                    if (SourceQtyCtl == "N")
                    {
                        FillSelectData(oIFCLD_ICMOList.oBillSelectColl);
                        txtHSourceBillNo.Text = "";
                        if (oIFCLD_ICMOList.RefreshBySourceBillNo(" Where å•据号 like '%" + txtHSourceBillNo.Text + "' and HOrgID =" + sHOrgID.ToString() + " and ä»»åŠ¡æ•°é‡>0"))  //选择原单
                        {
                            FillSelectData(oIFCLD_ICMOList.oBillSelectColl);
                            txtHSourceBillNo.Text = "";
                        }
                        else
                        {
                            MessageBox.Show("未查询到任务数据,请确认所选组织、源单类型与源单单号是否正确!");
                            return;
                        }
                    }
                    else
                    {
                        MessageBox.Show("未查询到任务数据,请确认所选组织、源单类型与源单单号是否正确!");
                        return;
                        if (oIFCLD_ICMOList.RefreshBySourceBillNo(" Where å•据号 like '%" + txtHSourceBillNo.Text + "' and HOrgID =" + sHOrgID.ToString()))  //选择原单
                        {
                            FillSelectData(oIFCLD_ICMOList.oBillSelectColl);
                            txtHSourceBillNo.Text = "";
                        }
                        else
                        {
                            MessageBox.Show("未查询到任务数据,请确认所选组织、源单类型与源单单号是否正确!");
                            return;
                        }
                    }
                }
                else if (cmbSourceBillType.Text.Trim() == "生产汇报单")
WebAPI/Controllers/BLL/Xt_UserController.cs
@@ -206,14 +206,14 @@
                    ",HWhID,HWHName,HSupID,HSupName " +
                    ",HSCWHID,HSCWHName " +
                    ",HCloudUserName,HCloudUserPsd,HUSEORGID,HProcID" +
                    ",HGroupID,HSourceID) " +
                    ",HGroupID,HSourceID,HCheckEmpID) " +
                    "values ('" + lsmain[0].Czybm.ToString() + "','" + lsmain[0].Czymc.ToString() + "','" + ClsPub.StrToPsd(lsmain[0].Czmm.ToString()) + "','" + lsmain[0].Explain.ToString() + "','" + lsmain[0].HEmpID.ToString() + "',"+ lsmain[0].HK3UserID.ToString() + "" +
                    ","+ lsmain[0].HKeeperID.ToString() + ",'"+ lsmain[0].HKeeper.ToString() + "',"+ lsmain[0].HSecManagerID.ToString() + ",'"+ lsmain[0].HSecManager.ToString() + "'" +
                    "," + lsmain[0].HSellManID.ToString() + ",'" + lsmain[0].HSellMan.ToString() + "'," + lsmain[0].HDeptID.ToString() + ",'" + lsmain[0].HDept.ToString() + "'" +
                    "," + lsmain[0].HWhID.ToString() + ",'" + lsmain[0].HWHName.ToString() + "'," + lsmain[0].HSupID.ToString() + ",'" + lsmain[0].HSupName.ToString() + "'" +
                    "," + lsmain[0].HSCWHID.ToString() + ",'" + lsmain[0].HSCWHName.ToString() + "'" + 
                    ",'" + lsmain[0].HCloudUserName.ToString() + "','" + lsmain[0].HCloudUserPsd.ToString() + "',"+ lsmain[0].HOrgID.ToString() + "," + lsmain[0].HProcID.ToString() + "" +
                    ","+ lsmain[0].HGroupID.ToString() + ","+ lsmain[0].HSourceID.ToString() + ")");
                    ","+ lsmain[0].HGroupID.ToString() + ","+ lsmain[0].HSourceID.ToString() + "," + lsmain[0].HCheckEmpID.ToString() + ")");
                    //新增后查询  ç¡®ä¿æ•°æ®æ·»åŠ æˆåŠŸ
                    ds = oCN.RunProcReturn("Select * from  Gy_Czygl where Czybm='" + lsmain[0].Czybm.ToString() + "'", "Gy_Czygl");
@@ -256,6 +256,7 @@
                        ",HDeptID=" + lsmain[0].HDeptID.ToString() +
                        ",HDept='" + lsmain[0].HDept.ToString() + "'" +
                        ",HWhID=" + lsmain[0].HWhID.ToString() +
                        ",HCheckEmpID=" + lsmain[0].HCheckEmpID.ToString() +
                        ",HWHName='" + lsmain[0].HWHName.ToString() + "'" +
                        ",HSCWHID=" + lsmain[0].HSCWHID.ToString() +
                        ",HSCWHName='" + lsmain[0].HSCWHName.ToString() + "'" +
@@ -283,6 +284,7 @@
                           ",HSellMan='" + lsmain[0].HSellMan.ToString() + "'" +
                           ",HDeptID=" + lsmain[0].HDeptID.ToString() +
                           ",HDept='" + lsmain[0].HDept.ToString() + "'" +
                           ",HCheckEmpID=" + lsmain[0].HCheckEmpID.ToString() +
                           ",HWhID=" + lsmain[0].HWhID.ToString() +
                           ",HWHName='" + lsmain[0].HWHName.ToString() + "'" +
                           ",HSCWHID=" + lsmain[0].HSCWHID.ToString() +
WebAPI/Controllers/CGGL/Cg_POInStockBillController.cs
@@ -446,10 +446,12 @@
                Single HExRate = mainList[0].HExRate;//汇率
                long HManagerID = mainList[0].HManagerID;//主管
                long HWHID = mainList[0].HWHID;//仓库
                long HProjectID = mainList[0].HProjectID;//项目
                string HMaker = user;//制单人
                string HAddress = mainList[0].HAddress;//地址
                string HExplanation = mainList[0].HExplanation;//摘要
                string HInnerBillNo = mainList[0].HInnerBillNo;//内部单据号 
                string HInvoiceBillNo = mainList[0].HInvoiceBillNo;//发票编号
                List<ClsCg_POInStockBillMain> mainList2 = Newtonsoft.Json.JsonConvert.DeserializeObject<List<ClsCg_POInStockBillMain>>(msg2);
                DateTime dt = DateTime.Now;
@@ -512,13 +514,14 @@
                        ,HMaker,HMakeDate,HOWNERTYPEID,HOWNERID
                        ,HERPInterID,HERPBillType,HPURCHASEORGID,HSTOCKORGID,HREQUIREORGID
                        ,HSTOCKGROUPID,HSENDBILLNO,HLADBILLNO,HPURDEPTID,HPURGROUPID,HSUPPLYID
                        ,HSETTLEID,HCHARGEID,HBUSINESSTYPE,HSUPPLYADDRESS,HCORRESPONDORGID,HPROVIDERCONTACTID,HCurID,HExRate,HAddress,HWHID,HInnerBillNo)
                        ,HSETTLEID,HCHARGEID,HBUSINESSTYPE,HSUPPLYADDRESS,HCORRESPONDORGID,HPROVIDERCONTACTID,HCurID,HExRate,HAddress,HWHID,HInnerBillNo
                        ,HProjectID,HInvoiceBillNo)
                        values(" + HInterID + "," + DateTime.Now.Year + "," + DateTime.Now.Month + ",'" + 1103 + "','" +
                    HBillSubType + "','" + HDate + "','" + HBillNo + "'," + HBillStatus + "," + HSupID +
                    "," + HManagerID + "," + HEmpID + "," + HDeptID + ",'" + HRemark + "','" + HMaker +
                    "',getdate()" + ",'" + HOWNERTYPEID + "'," + HOWNERID + "," + HERPInterID + ",'" + HERPBillType + "'," + HPURCHASEORGID + "," + HSTOCKORGID + "," + HREQUIREORGID + "," +
                    HSTOCKGROUPID + ",'" + HSENDBILLNO + "','" + HLADBILLNO + "'," + HPURDEPTID + "," + HPURGROUPID + "," + HSUPPLYID + "," +
                    HSETTLEID + "," + HCHARGEID + ",'" + HBUSINESSTYPE + "','" + HSUPPLYADDRESS + "'," + HCORRESPONDORGID + "," + HPROVIDERCONTACTID + "," + HCurID + "," + HExRate + ",'" + HAddress + "'," + HWHID + ",'" + HInnerBillNo + "')";
                    HSETTLEID + "," + HCHARGEID + ",'" + HBUSINESSTYPE + "','" + HSUPPLYADDRESS + "'," + HCORRESPONDORGID + "," + HPROVIDERCONTACTID + "," + HCurID + "," + HExRate + ",'" + HAddress + "'," + HWHID + ",'" + HInnerBillNo + "',"+ HProjectID + ",'"+ HInvoiceBillNo + "')";
                   
                    oCN.RunProc(sql);
@@ -529,7 +532,7 @@
                                "HRemark='" + HRemark + "', HUpDater ='" + HMaker + "', HUpDateDate=getdate()" +
                                 ",HSupID=" + HSupID + ",HCurID=" + HCurID
                                 + ",HExRate=" + HExRate + ",HEmpID=" + HEmpID + ",HManagerID=" + HManagerID + ",HDeptID=" + HDeptID
                                 + ",HAddress='" + HAddress + "',HInnerBillNo='" + HInnerBillNo + "' where HInterID=" + HInterID;
                                 + ",HAddress='" + HAddress + "',HInnerBillNo='" + HInnerBillNo + "',HProjectID="+ HProjectID + ",HInvoiceBillNo='"+ HInvoiceBillNo + "' where HInterID=" + HInterID;
                    oCN.RunProc(sql);
WebAPI/Controllers/CGGL/Cg_POOrderBillController.cs
@@ -745,6 +745,8 @@
                string HAddress = mainList[0].HAddress;//地址
                string HExplanation = mainList[0].HExplanation;//摘要
                string HInnerBillNo = mainList[0].HInnerBillNo;//内部单据号 
                long HWHID = mainList[0].HWHID;//仓库
                long HProjectID = mainList[0].HProjectID;//仓库
                List<ClsCg_POOrderBillMain> mainList2 = Newtonsoft.Json.JsonConvert.DeserializeObject<List<ClsCg_POOrderBillMain>>(msg2);
                DateTime dt = DateTime.Now;
@@ -814,13 +816,15 @@
                        ,HExRate,HEmpID,HManagerID,HDeptID,HExplanation,HRemark,HInnerBillNo
                        ,HMaker,HMakeDate
                        ,HERPInterID,HERPBillType,HPURCHASEORGID
                        ,HPURCHASERGROUPID,HPROVIDERID,HSETTLEID,HCHARGEID,HBUSINESSTYPE,HPROVIDERADDRESS,HCORRESPONDORGID,HPROVIDERCONTACTID)
                        ,HPURCHASERGROUPID,HPROVIDERID,HSETTLEID,HCHARGEID,HBUSINESSTYPE,HPROVIDERADDRESS,HCORRESPONDORGID,HPROVIDERCONTACTID
                        ,HWHID,HProjectID)
                        values(" + HInterID + "," + DateTime.Now.Year + "," + DateTime.Now.Month + ",'" + 1102 + "','" +
                    1102 + "','" + HDate + "','" + HBillNo + "','" + HBillStatus + "','" + HAddress +
                    "'," + HSSID + ",'" + HSSDate + "'," + HPSStyleID + "," + HSupID + "," + HCurID +
                    "," + HExRate + "," + HEmpID + "," + HManagerID + "," + HDeptID + ",'" + HExplanation + "','" + HRemark + "','" + HInnerBillNo + "','" + HMaker + "',getdate()" + "," + HERPInterID + ",'" + HERPBillType + "'," + HPURCHASEORGID + "," + HPURCHASERGROUPID + ","
                    + HPROVIDERID + "," + HSETTLEID + "," + HCHARGEID + ",'" + HBUSINESSTYPE + "','" + HPROVIDERADDRESS + "',"
                    + HCORRESPONDORGID + "," + HPROVIDERCONTACTID + ")");
                    + HCORRESPONDORGID + "," + HPROVIDERCONTACTID + ","
                    + HWHID+","+ HProjectID + ")");
                }
                else if (OperationType == 3 || ds.Tables[0].Rows.Count != 0)
                { //修改
@@ -828,7 +832,7 @@
                                "HRemark='" + HRemark + "', HUpDater='" + HMaker + "', HUpDateDate=getdate()" +
                                 ",HSSID=" + HSSID + ",HPSStyleID=" + HPSStyleID + ",HSupID=" + HSupID + ",HCurID=" + HCurID
                                 + ",HExRate=" + HExRate + ",HEmpID=" + HEmpID + ",HManagerID=" + HManagerID + ",HDeptID=" + HDeptID
                                 + ",HAddress='" + HAddress + "',HSSDate='" + HSSDate + "' where HInterID=" + HInterID);
                                 + ",HAddress='" + HAddress + "',HSSDate='" + HSSDate + "',HWHID="+ HWHID + ",HProjectID="+ HProjectID + " where HInterID=" + HInterID);
                    //删除子表
                    oCN.RunProc("delete from Cg_POOrderBillSub where HInterID='" + HInterID + "'");
@@ -878,6 +882,7 @@
            string HMTONo = DetailColl2[0].HMTONo == null ? "''" : DetailColl2[0].HMTONo;
            long HERPInterID = DetailColl2[0].HERPInterID == null ? 0 : DetailColl2[0].HERPInterID;
            long HERPEntryID = DetailColl2[0].HERPEntryID == null ? 0 : DetailColl2[0].HERPEntryID;
            long HWHID = DetailColl2[0].HWHID == null ? 0 : DetailColl2[0].HWHID;
            string HSeOrderBillNo = DetailColl2[0].HSeOrderBillNo == null ? "''" : DetailColl2[0].HSeOrderBillNo;
            string HRemark = DetailColl2[0].HRemark == null ? "''" : DetailColl2[0].HRemark;
@@ -978,10 +983,10 @@
                ,HSEQ,HRECEIVEDEPTID,HSUPPLIERLOT,HBOMID,HSTOCKUNITID,HBASEUNITID,HBFLOWID,HGIVEAWAY,HROWTYPE,HBASEUNITQTY,HSTOCKBASEQTY
                ,HREQTRACENO,HTAXNETPRICE,HPRICECOEFFICIENT,HTAXCOMBINATION,HPRICEUNITID,HPRICELISTENTRY,HPAYORGID,HSETTLEMODEID,HSETTLECURRID
                ,HEXCHANGETYPEID,HPAYCONDITIONID,HEXCHANGERATE,HLOCALCURRID,HISINCLUDEDTAX,HISPRICEEXCLUDETAX,HTAXRATEID,HCOSTPERCENT,HCOSTAMOUNT
                ,HVAT,HSELLERWITHHOLDING,HBUYERWITHHOLDING,HMATERIALDESC)
                ,HVAT,HSELLERWITHHOLDING,HBUYERWITHHOLDING,HMATERIALDESC,HWHID)
                 values({HInterID},{NewHEntryID},{oSub.HMaterID},{oSub.HUnitID},{(oSub.HQty == null ? 0 : oSub.HQty)}
                ,{oSub.HPrice},{oSub.HTaxPrice},{oSub.HDiscountRate},{oSub.HRelTaxPrice},{oSub.HMoney},{oSub.HTaxRate},{oSub.HTaxMoney},{oSub.HlineTotal},{oSub.HlineTotalBB},'{oSub.HDate}',{oSub.HInStockQty},{oSub.HInvoiceQty},{HSeOrderBillNo},{oSub.HSeOrderInterID},{oSub.HSeOrderEntryID},'{HRemark}',{HSourceInterID},{HSourceEntryID},{HSourceBillNo},{HSourceBillType},{HRelationQty},{HBackRelationQty},{HPropertyID},{HBatChNo},
                  {HAuxPropID},{HMTONo},{HERPInterID},{HERPEntryID},{HSTOCKORGID},{HSEQ},{HRECEIVEDEPTID},'{HSUPPLIERLOT}',{HBOMID},{HSTOCKUNITID},{HBASEUNITID},'{HBFLOWID}',{HGIVEAWAY},{HROWTYPE},{HBASEUNITQTY},{HSTOCKBASEQTY},'{HREQTRACENO}',{HTAXNETPRICE},{HPRICECOEFFICIENT},{HTAXCOMBINATION},{HPRICEUNITID},{HPRICELISTENTRY},{HPAYORGID},{HSETTLEMODEID},{HSETTLECURRID},{HEXCHANGETYPEID},{HPAYCONDITIONID},{HEXCHANGERATE},{HLOCALCURRID},{HISINCLUDEDTAX},{HISPRICEEXCLUDETAX},{HTAXRATEID},{HCOSTPERCENT},{HCOSTAMOUNT},{HVAT},{HSELLERWITHHOLDING},{HBUYERWITHHOLDING},'{HMATERIALDESC}')");
                  {HAuxPropID},{HMTONo},{HERPInterID},{HERPEntryID},{HSTOCKORGID},{HSEQ},{HRECEIVEDEPTID},'{HSUPPLIERLOT}',{HBOMID},{HSTOCKUNITID},{HBASEUNITID},'{HBFLOWID}',{HGIVEAWAY},{HROWTYPE},{HBASEUNITQTY},{HSTOCKBASEQTY},'{HREQTRACENO}',{HTAXNETPRICE},{HPRICECOEFFICIENT},{HTAXCOMBINATION},{HPRICEUNITID},{HPRICELISTENTRY},{HPAYORGID},{HSETTLEMODEID},{HSETTLECURRID},{HEXCHANGETYPEID},{HPAYCONDITIONID},{HEXCHANGERATE},{HLOCALCURRID},{HISINCLUDEDTAX},{HISPRICEEXCLUDETAX},{HTAXRATEID},{HCOSTPERCENT},{HCOSTAMOUNT},{HVAT},{HSELLERWITHHOLDING},{HBUYERWITHHOLDING},'{HMATERIALDESC}',{HWHID})");
            }
            //保存后控制=========================================              
WebAPI/Controllers/CGGL/Kf_POStockInBillController.cs
@@ -148,10 +148,12 @@
                long HSCWHID = mainList[0].HSCWHID;//调出仓库
                long HSecManagerID = mainList[0].HSecManagerID;//验收
                long HKeeperID = mainList[0].HKeeperID;//保管员
                long HProjectID = mainList[0].HProjectID;//项目
       
                string HInvoiceBillNo = mainList[0].HInvoiceBillNo;//发票编号
                string HExplanation = mainList[0].HExplanation;//摘要
                string HInnerBillNo = mainList[0].HInnerBillNo;//内部单据号 
@@ -198,12 +200,12 @@
                    String sql =$@"Insert Into Kf_ICStockBillMain 
                        (HInterID,HYear,HPeriod,HBillType,HBillSubType,HDate,HBillNo,HBillStatus
                        ,HAddress,HSupID,HCurID,HWHID,HEmpID,HManagerID,HSecManagerID,HKeeperID,HDeptID,HExplanation,HRemark
                        ,HInnerBillNo,HSTOCKORGID,HOWNERID,HMaker,HMakeDate)
                        ,HInnerBillNo,HSTOCKORGID,HOWNERID,HMaker,HMakeDate,HProjectID,HInvoiceBillNo)
                        values(" + HInterID + "," + DateTime.Now.Year + "," + DateTime.Now.Month + ",'" + 1201 + "','" +
                    HBillSubType + "','" + HDate + "','" + HBillNo + "','" + HBillStatus + "','" + HAddress +
                    "'," + HSupID + "," + HCurID + "," + HWHID + "," + HEmpID + "," + HManagerID + "," + 
                    HSecManagerID + ","+ HKeeperID +"," + HDeptID + ",'" + HExplanation + "','" + HRemark
                    + "','" + HInnerBillNo + "'," + HSTOCKORGID + "," + HOWNERID + ",'" + HMaker + "',getdate()" +")";
                    + "','" + HInnerBillNo + "'," + HSTOCKORGID + "," + HOWNERID + ",'" + HMaker + "',getdate(),"+ HProjectID + ",'"+ HInvoiceBillNo + "')";
                    oCN.RunProc(sql);
                }
@@ -213,7 +215,7 @@
                                "HRemark='" + HRemark + "', HUpDater='" + HMaker + "', HUpDateDate=getdate()" +
                                 ",HSupID=" + HSupID + ",HCurID=" + HCurID + ",HSecManagerID=" + HSecManagerID + ", HSTOCKORGID=" + HSTOCKORGID + ",HKeeperID=" + HKeeperID + ",HWHID = " + HWHID
                                 + ",HEmpID=" + HEmpID + ",HManagerID=" + HManagerID + ",HDeptID=" + HDeptID + ",HOWNERID=" + HOWNERID
                                 + ",HAddress='" + HAddress + "',HInnerBillNo='" + HInnerBillNo + "' where HInterID=" + HInterID;
                                 + ",HAddress='" + HAddress + "',HInnerBillNo='" + HInnerBillNo + "',HProjectID="+ HProjectID + ",HInvoiceBillNo='"+ HInvoiceBillNo + "' where HInterID=" + HInterID;
                    oCN.RunProc(sql);
                    //删除子表
@@ -329,13 +331,15 @@
                ,HMoney,HOrderPrice,HWHID,HSPID,HRelationQty,HBatchNo
                ,HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType
                ,HPOOrderInterID,HPOOrderEntryID ,HPOOrderBillNo
                ,HPropertyID,HSecUnitID,HSecUnitRate,HPlanMode,HRemark,HSeOrderInterID,HSeOrderEntryID,HSeOrderBillNo)
                ,HPropertyID,HSecUnitID,HSecUnitRate,HPlanMode,HRemark,HSeOrderInterID,HSeOrderEntryID,HSeOrderBillNo
                ,HTaxRate,HTaxPrice,HlineTotal)
                 values({HInterID},{NewHEntryID},{oSub.HMaterID},{oSub.HUnitID}
                ,{oSub.HQtyMust},{(oSub.HQty == null ? 0 : oSub.HQty)},{oSub.HPrice},{oSub.HMoney},{oSub.HOrderPrice},{oSub.HWHID},{oSub.HSPID},{oSub.HRelationQty}
                ,'{oSub.HBatchNo}',{oSub.HSourceInterID},{oSub.HSourceEntryID},'{oSub.HSourceBillNo}','{oSub.HSourceBillType}'
                ,{oSub.HPOOrderInterID},{oSub.HPOOrderEntryID},'{oSub.HPOOrderBillNo}'
                ,{(oSub.HPropertyID == null ? 0 : oSub.HPropertyID)},{(oSub.HSecUnitID == null ? 0 : oSub.HSecUnitID)},{(oSub.HSecUnitRate == null ? 0 : oSub.HSecUnitRate)}
                ,{(oSub.HPlanMode == null ? 0 : oSub.HPlanMode)},'{oSub.HRemark}',{oSub.HSeOrderInterID},{oSub.HSeOrderEntryID},'{oSub.HSeOrderBillNo}')";
                ,{(oSub.HPlanMode == null ? 0 : oSub.HPlanMode)},'{oSub.HRemark}',{oSub.HSeOrderInterID},{oSub.HSeOrderEntryID},'{oSub.HSeOrderBillNo}'
                ,{(oSub.HTaxRate == null ? 0 : oSub.HTaxRate)},{(oSub.HTaxPrice == null ? 0 : oSub.HTaxPrice)},{(oSub.HlineTotal == null ? 0 : oSub.HlineTotal)})";
                //string sReturn = "";
                //ds = oCN.RunProcReturn("exec h_p_Cg_POInStockBillMain " + oSub.HQty + ", '" +oSub.HSourceInterID + "', '" + oSub.HSourceEntryID + "','" + user+" '", "h_p_Cg_POInStockBillMain");
WebAPI/Controllers/SCGL/Sc_MESTransFerWorkBillController.cs
@@ -172,9 +172,8 @@
                //保存
                //保存完毕后处理
                bool bResult;
                if (oBill.omodel.HInterID == 0)
                if (refSav == "Add")
                {
                    bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo);
                    if (bResult)
                    {
@@ -423,7 +422,7 @@
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        }
        public static DataSet Get_TransFerBillList(string sWhere)
        {
@@ -440,6 +439,63 @@
            return new SQLHelper.ClsCN().RunProcReturn(sql, "OA_ErrMsgBackBillMain");
        }
        #endregion
        #region å¼‚常反馈列表PDA
        [Route("Sc_MESTransFerWorkBill/Get_TransFerBillList_PDA")]
        [HttpGet]
        public object Get_TransFerBillList_PDA(string sWhere, string user)
        {
            try
            {
                List<object> columnNameList = new List<object>();
                //查看权限
                if (!DBUtility.ClsPub.Security_Log("OA_ErrMsgBackBill_Query", 1, false, user))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "无查看权限!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                if (sWhere == null || sWhere.Equals(""))
                {
                    string sql = "select * from h_v_OA_ErrMsgBackBillList_PDA order by å•据号 desc";
                    ds = oCN.RunProcReturn(sql, "h_v_OA_ErrMsgBackBillList_PDA");
                }
                else
                {
                    string sql1 = "select * from h_v_OA_ErrMsgBackBillList_PDA where 1 = 1 ";
                    string sql = sql1 + sWhere + " order by å•据号 desc";
                    ds = oCN.RunProcReturn(sql, "h_v_OA_ErrMsgBackBillList_PDA");
                }
                //添加列名
                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 = "Sucess!";
                objJsonResult.data = ds.Tables[0];
                objJsonResult.list = columnNameList;
                return objJsonResult;
            }
            catch (Exception ex)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "查询数据异常,请与管理员联系!" + ex.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
        #region å¼‚常反馈列表编辑获取数据
@@ -751,7 +807,7 @@
        [Route("Sc_MESTransFerWorkBill/Get_OA_ErrMsgBackList")]
        [HttpGet]
        public object Get_OA_ErrMsgBackList(string HInterID,string HEntryID, string user,int num)
        public object Get_OA_ErrMsgBackList(string HInterID,string HEntryID, string user,Int64 num)
        {
            try
            {
@@ -766,22 +822,46 @@
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                if (num == 1)       //异常反馈单
                string sql = "";
                string HViewName = "";
                switch (num)
                {
                    string sql = "select * from h_v_OA_ErrMsgBackBillList where HInterID = '" + HInterID + "' and HEntryID = '" + HEntryID + "'";
                    ds = oCN.RunProcReturn(sql, "p_v_OA_ErrMsgBackBillList");
                    case 1: //异常反馈单
                        sql = "select * from h_v_OA_ErrMsgBackBillList where HInterID = '" + HInterID + "' and HEntryID = '" + HEntryID + "'";
                        HViewName = "h_v_OA_ErrMsgBackBillList";
                        break;
                    case 2://异常反馈接收单
                        sql = "select * from h_v_OA_ErrMsgBackReceiveBillMainList  where hmainid = '" + HInterID + "'";
                        HViewName = "h_v_OA_ErrMsgBackReceiveBillMainList";
                        break;
                    case 3://异常反馈处理单
                        sql = "select * from h_v_OA_ErrMsgBackHandleBillMainList   where hmainid = '" + HInterID + "'";
                        HViewName = "h_v_OA_ErrMsgBackHandleBillMainList";
                        break;
                    case 10: //异常反馈单PDA
                        sql = "select * from h_v_OA_ErrMsgBackBillList_PDA where HInterID = '" + HInterID + "' and HEntryID = '" + HEntryID + "'";
                        HViewName = "h_v_OA_ErrMsgBackBillList_PDA";
                        break;
                    case 11://异常反馈接收单PDA
                        sql = "select * from h_v_OA_ErrMsgBackReceiveBillList_PDA  where hmainid = '" + HInterID + "'";
                        HViewName = "h_v_OA_ErrMsgBackReceiveBillList_PDA";
                        break;
                    case 12://异常反馈处理单PDA
                        sql = "select * from h_v_OA_ErrMsgBackHandleBillList_PDA   where hmainid = '" + HInterID + "'";
                        HViewName = "h_v_OA_ErrMsgBackHandleBillList_PDA";
                        break;
                }
                else if (num==2)    //异常反馈接收单
                if(sql == "")
                {
                    string sql = "select * from h_v_OA_ErrMsgBackReceiveBillMainList  where hmainid = '" + HInterID + "'";
                    ds = oCN.RunProcReturn(sql, "h_v_OA_ErrMsgBackReceiveBillMainList");
                }
                else if (num == 3)    //异常反馈处理单
                {
                    string sql = "select * from h_v_OA_ErrMsgBackHandleBillMainList   where hmainid = '" + HInterID + "'";
                    ds = oCN.RunProcReturn(sql, "h_v_OA_ErrMsgBackHandleBillMainList ");
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "查询数据异常,递入源单类型num不正确!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                ds = oCN.RunProcReturn(sql, HViewName);
                //添加列名
                foreach (DataColumn col in ds.Tables[0].Columns)
                {
@@ -1030,6 +1110,64 @@
                    string sql1 = "select * from h_v_OA_ErrMsgBackReceiveBillMainList where 1 = 1 ";
                    string sql = sql1 + sWhere + " order by å•据号 desc";
                    ds = oCN.RunProcReturn(sql, "h_v_OA_ErrMsgBackReceiveBillMainList");
                }
                //添加列名
                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 = "Sucess!";
                objJsonResult.data = ds.Tables[0];
                objJsonResult.list = columnNameList;
                return objJsonResult;
            }
            catch (Exception ex)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "查询数据异常,请与管理员联系!" + ex.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
        #region å¼‚常反馈接收单列表PDA
        [Route("Sc_MESTransFerWorkBill/Get_OA_ErrMsgBackReceiveBillList_PDA")]
        [HttpGet]
        public object Get_OA_ErrMsgBackReceiveBillList_PDA(string sWhere, string user)
        {
            try
            {
                List<object> columnNameList = new List<object>();
                //查看权限
                if (!DBUtility.ClsPub.Security_Log("OA_ErrMsgBackReceiveBillMain_Query", 1, false, user))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "无查看权限!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                if (sWhere == null || sWhere.Equals(""))
                {
                    string sql = "select * from h_v_OA_ErrMsgBackReceiveBillList_PDA order by å•据号 desc";
                    ds = oCN.RunProcReturn(sql, "h_v_OA_ErrMsgBackReceiveBillList_PDA");
                }
                else
                {
                    string sql1 = "select * from h_v_OA_ErrMsgBackReceiveBillList_PDA where 1 = 1 ";
                    string sql = sql1 + sWhere + " order by å•据号 desc";
                    ds = oCN.RunProcReturn(sql, "h_v_OA_ErrMsgBackReceiveBillList_PDA");
                }
                //添加列名
@@ -1916,6 +2054,64 @@
        }
        #endregion
        #region å¼‚常反馈签到单列表PDA
        [Route("Sc_MESTransFerWorkBill/Get_OA_ErrMsgBackSignBillList_PDA")]
        [HttpGet]
        public object Get_OA_ErrMsgBackSignBillList_PDA(string sWhere, string user)
        {
            try
            {
                List<object> columnNameList = new List<object>();
                //查看权限
                if (!DBUtility.ClsPub.Security_Log("OA_ErrMsgBackSignBillMain_Query", 1, false, user))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "无查看权限!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                if (sWhere == null || sWhere.Equals(""))
                {
                    string sql = "select * from h_v_OA_ErrMsgBackSignBillList_PDA order by å•据号 desc";
                    ds = oCN.RunProcReturn(sql, "h_v_OA_ErrMsgBackSignBillList_PDA");
                }
                else
                {
                    string sql1 = "select * from h_v_OA_ErrMsgBackSignBillList_PDA where 1 = 1 ";
                    string sql = sql1 + sWhere + " order by å•据号 desc";
                    ds = oCN.RunProcReturn(sql, "h_v_OA_ErrMsgBackSignBillList_PDA");
                }
                //添加列名
                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 = "Sucess!";
                objJsonResult.data = ds.Tables[0];
                objJsonResult.list = columnNameList;
                return objJsonResult;
            }
            catch (Exception ex)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "查询数据异常,请与管理员联系!" + ex.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
        #region å¼‚常反馈签到单 åˆ é™¤
        /// <summary>
        ///参数:string HInterID。
@@ -2773,6 +2969,64 @@
            }
        }
        #endregion
        #region å¼‚常反馈处理单列表PDA
        [Route("Sc_MESTransFerWorkBill/Get_OA_ErrMsgBackHandleBillList_PDA")]
        [HttpGet]
        public object Get_OA_ErrMsgBackHandleBillList_PDA(string sWhere, string user)
        {
            try
            {
                List<object> columnNameList = new List<object>();
                //查看权限
                if (!DBUtility.ClsPub.Security_Log("OA_ErrMsgBackHandleBillMain_Query", 1, false, user))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "无查看权限!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                if (sWhere == null || sWhere.Equals(""))
                {
                    string sql = "select * from h_v_OA_ErrMsgBackHandleBillList_PDA order by å•据号 desc";
                    ds = oCN.RunProcReturn(sql, "h_v_OA_ErrMsgBackHandleBillList_PDA");
                }
                else
                {
                    string sql1 = "select * from h_v_OA_ErrMsgBackHandleBillList_PDA where 1 = 1 ";
                    string sql = sql1 + sWhere + " order by å•据号 desc";
                    ds = oCN.RunProcReturn(sql, "h_v_OA_ErrMsgBackHandleBillList_PDA");
                }
                //添加列名
                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 = "Sucess!";
                objJsonResult.data = ds.Tables[0];
                objJsonResult.list = columnNameList;
                return objJsonResult;
            }
            catch (Exception ex)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "查询数据异常,请与管理员联系!" + ex.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
        #region å¼‚常反馈处理单 åˆ é™¤
@@ -3629,6 +3883,64 @@
        }
        #endregion
        #region å¼‚常反馈验收单列表PDA
        [Route("Sc_MESTransFerWorkBill/Get_OA_ErrMsgBackCheckBillList_PDA")]
        [HttpGet]
        public object Get_OA_ErrMsgBackCheckBillList_PDA(string sWhere, string user)
        {
            try
            {
                List<object> columnNameList = new List<object>();
                //查看权限
                if (!DBUtility.ClsPub.Security_Log("OA_ErrMsgBackCheckBillMain_Query", 1, false, user))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "无查看权限!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                if (sWhere == null || sWhere.Equals(""))
                {
                    string sql = "select * from h_v_OA_ErrMsgBackCheckBillList_PDA order by å•据号 desc";
                    ds = oCN.RunProcReturn(sql, "h_v_OA_ErrMsgBackCheckBillList_PDA");
                }
                else
                {
                    string sql1 = "select * from h_v_OA_ErrMsgBackCheckBillList_PDA where 1 = 1 ";
                    string sql = sql1 + sWhere + " order by å•据号 desc";
                    ds = oCN.RunProcReturn(sql, "h_v_OA_ErrMsgBackCheckBillList_PDA");
                }
                //添加列名
                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 = "Sucess!";
                objJsonResult.data = ds.Tables[0];
                objJsonResult.list = columnNameList;
                return objJsonResult;
            }
            catch (Exception ex)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "查询数据异常,请与管理员联系!" + ex.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
        #region å¼‚常反馈验收单 åˆ é™¤
        [Route("Sc_MESTransFerWorkBill/DeleteOA_ErrMsgBackCheckBill")]
WebAPI/Controllers/SCGL/Sc_ProductionReturnBillController.cs
@@ -6,6 +6,8 @@
using Pub_Class;
using System.Web.Http;
using WebAPI.Models;
using Model;
using Newtonsoft.Json.Linq;
namespace WebAPI.Controllers.SCGL
{
@@ -15,11 +17,53 @@
        private json objJsonResult = new json();
        public DataSet ds = new DataSet();
        public WebServer webserver = new WebServer();
        public DAL.ClsCg_POInStockBill BillOld = new DAL.ClsCg_POInStockBill();
        //public DAL.ClsCg_POInStockBill BillOld = new DAL.ClsCg_POInStockBill();
        public DAL.ClsSc_ProductionReturnBill BillOld = new DAL.ClsSc_ProductionReturnBill();
        public SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
        SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
        #region ç”Ÿäº§é€€åº“单 æŸ¥æ‰¾è®°å½•功能
        /// <summary>
        /// æ ¹æ®åŸºç¡€èµ„æ–™ID æŸ¥æ‰¾è®°å½•
        ///参数:string sql。
        ///返回值:object。
        /// </summary>
        [Route("Sc_ProductionReturnBill/cx")]
        [HttpGet]
        public object cx(long HInterID)
        {
            try
            {
                ds = oCN.RunProcReturn("select * from h_v_IF_ProductionReturnList where hmainid=" + HInterID, "h_v_IF_ProductionReturnList");
                if (ds == null || ds.Tables[0].Rows.Count == 0)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "false!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                else
                {
                    objJsonResult.code = "1";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "Sucess!";
                    objJsonResult.data = ds.Tables[0];
                    return objJsonResult;
                }
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "Exception!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
        /// <summary>
        /// ç”Ÿäº§é€€åº“单列表
@@ -163,298 +207,298 @@
        }
        #endregion
        //#region ç”Ÿäº§å…¥åº“单  ä¿å­˜/编辑功能
        //[Route("Kf_ProductInBill/ProductInBillEdit")]
        //[HttpPost]
        //public object ProductInBillEdit([FromBody] JObject sMainSub)
        //{
        //    try
        //    {
        //        var _value = sMainSub["sMainSub"].ToString();
        //        string msg1 = _value.ToString();
        //        oCN.BeginTran();
        //        //保存主表
        //        objJsonResult = AddBillMain(msg1);
        //        if (objJsonResult.code == "0")
        //        {
        //            oCN.RollBack();
        //            objJsonResult.code = "0";
        //            objJsonResult.count = 0;
        //            objJsonResult.Message = objJsonResult.Message;
        //            objJsonResult.data = null;
        //            return objJsonResult;
        //        }
        //        oCN.Commit();
        //        objJsonResult.code = "1";
        //        objJsonResult.count = 1;
        //        objJsonResult.Message = "单据保存成功!";
        //        objJsonResult.data = null;
        //        return objJsonResult;
        #region ç”Ÿäº§é€€åº“单  ä¿å­˜/编辑功能
        [Route("Sc_ProductionReturnBill/ProductionReturnBillEdit")]
        [HttpPost]
        public object ProductionReturnBillEdit([FromBody] JObject sMainSub)
        {
            try
            {
                var _value = sMainSub["sMainSub"].ToString();
                string msg1 = _value.ToString();
                oCN.BeginTran();
                //保存主表
                objJsonResult = AddBillMain(msg1);
                if (objJsonResult.code == "0")
                {
                    oCN.RollBack();
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = objJsonResult.Message;
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                oCN.Commit();
                objJsonResult.code = "1";
                objJsonResult.count = 1;
                objJsonResult.Message = "单据保存成功!";
                objJsonResult.data = null;
                return objJsonResult;
        //    }
        //    catch (Exception e)
        //    {
        //        oCN.RollBack();
        //        objJsonResult.code = "0";
        //        objJsonResult.count = 0;
        //        objJsonResult.Message = "保存失败!" + e.ToString();
        //        objJsonResult.data = null;
        //        return objJsonResult;
        //    }
        //}
            }
            catch (Exception e)
            {
                oCN.RollBack();
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "保存失败!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        //public json AddBillMain(string msg1)
        //{
        //    string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
        //    string msg2 = sArray[0].ToString(); //主表数据
        //    string msg3 = sArray[1].ToString(); //子表数据
        //    int OperationType = int.Parse(sArray[2].ToString()); // æ•°æ®ç±»åž‹ 1添加 3修改
        //    string user = sArray[3].ToString();
        //    string msg_allVal = sArray[4].ToString(); //主表+子表所有数据
        public json AddBillMain(string msg1)
        {
            string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
            string msg2 = sArray[0].ToString(); //主表数据
            string msg3 = sArray[1].ToString(); //子表数据
            int OperationType = int.Parse(sArray[2].ToString()); // æ•°æ®ç±»åž‹ 1添加 3修改
            string user = sArray[3].ToString();
            string msg_allVal = sArray[4].ToString(); //主表+子表所有数据
        //    try
        //    {
        //        msg2 = "[" + msg2.ToString() + "]";
        //        List<ClsKf_ProductInBillMain> mainList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<ClsKf_ProductInBillMain>>(msg2);
            try
            {
                msg2 = "[" + msg2.ToString() + "]";
                List<ClsSc_ProductionReturnBillMain> mainList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<ClsSc_ProductionReturnBillMain>>(msg2);
        //        long HInterID = mainList[0].HInterID;//递入type得到的单据ID
        //        string HBillNo = mainList[0].HBillNo;//递入type得到的单据号
        //        long HPRDORGID = mainList[0].HPRDORGID;//组织
        //        DateTime HDate = mainList[0].HDate;//日期
        //        string HRemark = mainList[0].HRemark;//备注
        //        long HSupID = mainList[0].HSupID;//供应商
        //        long HEmpID = mainList[0].HEmpID;//业务员
        //        long HDeptID = mainList[0].HDeptID;//部门
        //        long HSecManagerID = mainList[0].HSecManagerID;//验收员
        //        long HKeeperID = mainList[0].HKeeperID;//保管员
        //        long HCurID = mainList[0].HCurID;//币别
        //        Single HExRate = mainList[0].HExRate;//汇率
        //        long HManagerID = mainList[0].HManagerID;//主管
        //        long HWHID = mainList[0].HWHID;//仓库
        //        string HMaker = user;//制单人
        //        string HExplanation = mainList[0].HExplanation;//摘要
        //        string HInnerBillNo = mainList[0].HInnerBillNo;//内部单据号
                long HInterID = mainList[0].HInterID;//递入type得到的单据ID
                string HBillNo = mainList[0].HBillNo;//递入type得到的单据号
                long HPRDORGID = mainList[0].HPRDORGID;//组织
                DateTime HDate = mainList[0].HDate;//日期
                string HRemark = mainList[0].HRemark;//备注
                long HSupID = mainList[0].HSupID;//供应商
                long HEmpID = mainList[0].HEmpID;//业务员
                long HDeptID = mainList[0].HDeptID;//部门
                long HSecManagerID = mainList[0].HSecManagerID;//验收员
                long HKeeperID = mainList[0].HKeeperID;//保管员
                long HCurID = mainList[0].HCurID;//币别
                Single HExRate = mainList[0].HExRate;//汇率
                long HManagerID = mainList[0].HManagerID;//主管
                long HWHID = mainList[0].HWHID;//仓库
                string HMaker = user;//制单人
                string HExplanation = mainList[0].HExplanation;//摘要
                string HInnerBillNo = mainList[0].HInnerBillNo;//内部单据号
        //        List<ClsCg_POInStockBillMain> mainList2 = Newtonsoft.Json.JsonConvert.DeserializeObject<List<ClsCg_POInStockBillMain>>(msg2);
        //        DateTime dt = DateTime.Now;
        //        long HCORRESPONDORGID = mainList2[0].HOrgID;
        //        long HYear = mainList2[0].HYear == null ? 0 : mainList2[0].HYear;
        //        long HPeriod = mainList2[0].HPeriod == null ? 0 : mainList2[0].HPeriod;
        //        string HBillType = mainList2[0].HBillType == null ? "''" : mainList2[0].HBillType;
        //        string HBillSubType = mainList2[0].HBillSubType == null ? "''" : mainList2[0].HBillSubType;
        //        long HBillStatus = mainList2[0].HBillStatus == null ? 0 : mainList2[0].HBillStatus;
        //        string HMakeDate = mainList2[0].HMakeDate == null ? "''" : mainList2[0].HMakeDate;
        //        string HChecker = mainList2[0].HChecker == null ? "''" : mainList2[0].HChecker;
        //        string HCheckDate = mainList2[0].HCheckDate == null ? "''" : mainList2[0].HCheckDate;
        //        string HOWNERTYPEID = mainList2[0].HOWNERTYPEID == null ? "''" : mainList2[0].HOWNERTYPEID;
        //        long HOWNERID = mainList2[0].HOWNERID == null ? 0 : mainList2[0].HOWNERID;
        //        long HERPInterID = mainList2[0].HERPInterID == null ? 0 : mainList2[0].HERPInterID;
        //        string HERPBillType = mainList2[0].HERPBillType == null ? "''" : mainList2[0].HERPBillType;
        //        long HPURCHASEORGID = mainList2[0].HPURCHASEORGID == null ? 0 : mainList2[0].HPURCHASEORGID;
        //        long HSTOCKORGID = mainList2[0].HSTOCKORGID == null ? 0 : mainList2[0].HSTOCKORGID;
        //        long HREQUIREORGID = mainList2[0].HREQUIREORGID == null ? 0 : mainList2[0].HREQUIREORGID;
        //        long HSTOCKGROUPID = mainList2[0].HSTOCKGROUPID == null ? 0 : mainList2[0].HSTOCKGROUPID;
        //        string HSENDBILLNO = mainList2[0].HSENDBILLNO == null ? "''" : mainList2[0].HSENDBILLNO;
        //        string HLADBILLNO = mainList2[0].HLADBILLNO == null ? "''" : mainList2[0].HLADBILLNO;
        //        long HPURDEPTID = mainList2[0].HPURDEPTID == null ? 0 : mainList2[0].HPURDEPTID;
        //        long HPURGROUPID = mainList2[0].HPURGROUPID == null ? 0 : mainList2[0].HPURGROUPID;
        //        long HSUPPLYID = mainList2[0].HSUPPLYID == null ? 0 : mainList2[0].HSUPPLYID;
        //        long HSETTLEID = mainList2[0].HSETTLEID == null ? 0 : mainList2[0].HSETTLEID;
        //        long HCHARGEID = mainList2[0].HCHARGEID == null ? 0 : mainList2[0].HCHARGEID;
        //        string HBUSINESSTYPE = mainList2[0].HBUSINESSTYPE == null ? "''" : mainList2[0].HBUSINESSTYPE;
        //        string HSUPPLYADDRESS = mainList2[0].HSUPPLYADDRESS == null ? "''" : mainList2[0].HSUPPLYADDRESS;
        //        long HPROVIDERCONTACTID = mainList2[0].HPROVIDERCONTACTID == null ? 0 : mainList2[0].HPROVIDERCONTACTID;
                List<ClsCg_POInStockBillMain> mainList2 = Newtonsoft.Json.JsonConvert.DeserializeObject<List<ClsCg_POInStockBillMain>>(msg2);
                DateTime dt = DateTime.Now;
                long HCORRESPONDORGID = mainList2[0].HOrgID;
                long HYear = mainList2[0].HYear == null ? 0 : mainList2[0].HYear;
                long HPeriod = mainList2[0].HPeriod == null ? 0 : mainList2[0].HPeriod;
                string HBillType = mainList2[0].HBillType == null ? "''" : mainList2[0].HBillType;
                string HBillSubType = mainList2[0].HBillSubType == null ? "''" : mainList2[0].HBillSubType;
                long HBillStatus = mainList2[0].HBillStatus == null ? 0 : mainList2[0].HBillStatus;
                string HMakeDate = mainList2[0].HMakeDate == null ? "''" : mainList2[0].HMakeDate;
                string HChecker = mainList2[0].HChecker == null ? "''" : mainList2[0].HChecker;
                string HCheckDate = mainList2[0].HCheckDate == null ? "''" : mainList2[0].HCheckDate;
                string HOWNERTYPEID = mainList2[0].HOWNERTYPEID == null ? "''" : mainList2[0].HOWNERTYPEID;
                long HOWNERID = mainList2[0].HOWNERID == null ? 0 : mainList2[0].HOWNERID;
                long HERPInterID = mainList2[0].HERPInterID == null ? 0 : mainList2[0].HERPInterID;
                string HERPBillType = mainList2[0].HERPBillType == null ? "''" : mainList2[0].HERPBillType;
                long HPURCHASEORGID = mainList2[0].HPURCHASEORGID == null ? 0 : mainList2[0].HPURCHASEORGID;
                long HSTOCKORGID = mainList2[0].HSTOCKORGID == null ? 0 : mainList2[0].HSTOCKORGID;
                long HREQUIREORGID = mainList2[0].HREQUIREORGID == null ? 0 : mainList2[0].HREQUIREORGID;
                long HSTOCKGROUPID = mainList2[0].HSTOCKGROUPID == null ? 0 : mainList2[0].HSTOCKGROUPID;
                string HSENDBILLNO = mainList2[0].HSENDBILLNO == null ? "''" : mainList2[0].HSENDBILLNO;
                string HLADBILLNO = mainList2[0].HLADBILLNO == null ? "''" : mainList2[0].HLADBILLNO;
                long HPURDEPTID = mainList2[0].HPURDEPTID == null ? 0 : mainList2[0].HPURDEPTID;
                long HPURGROUPID = mainList2[0].HPURGROUPID == null ? 0 : mainList2[0].HPURGROUPID;
                long HSUPPLYID = mainList2[0].HSUPPLYID == null ? 0 : mainList2[0].HSUPPLYID;
                long HSETTLEID = mainList2[0].HSETTLEID == null ? 0 : mainList2[0].HSETTLEID;
                long HCHARGEID = mainList2[0].HCHARGEID == null ? 0 : mainList2[0].HCHARGEID;
                string HBUSINESSTYPE = mainList2[0].HBUSINESSTYPE == null ? "''" : mainList2[0].HBUSINESSTYPE;
                string HSUPPLYADDRESS = mainList2[0].HSUPPLYADDRESS == null ? "''" : mainList2[0].HSUPPLYADDRESS;
                long HPROVIDERCONTACTID = mainList2[0].HPROVIDERCONTACTID == null ? 0 : mainList2[0].HPROVIDERCONTACTID;
        //        ds = oCN.RunProcReturn("select * from h_v_IF_ProductInBillList where hmainid=" + HInterID + " and å•据号='" + HBillNo + "'", "h_v_IF_ProductInBillList");
        //        if ((OperationType == 1 || OperationType == 2 || OperationType == 4) && ds.Tables[0].Rows.Count == 0)//新增
        //        {
                ds = oCN.RunProcReturn("select * from h_v_IF_ProductionReturnList where hmainid=" + HInterID + " and å•据号='" + HBillNo + "'", "h_v_IF_ProductionReturnList");
                if ((OperationType == 1 || OperationType == 2 || OperationType == 4) && ds.Tables[0].Rows.Count == 0)//新增
                {
        //            //保存前控制=========================================
        //            ds = oCN.RunProcReturn("exec h_p_Kf_ProductInBill_BeforeSaveCtrl " + HInterID, "h_p_Kf_ProductInBill_BeforeSaveCtrl");
                    //保存前控制=========================================
                    ds = oCN.RunProcReturn("exec h_p_Sc_ProductionReturnBill_BeforeSaveCtrl " + HInterID, "h_p_Sc_ProductionReturnBill_BeforeSaveCtrl");
        //            if (ds == null || ds.Tables[0].Rows.Count == 0)
        //            {
        //                objJsonResult.code = "0";
        //                objJsonResult.count = 0;
        //                objJsonResult.Message = "保存前判断失败!";
        //                objJsonResult.data = null;
        //                return objJsonResult;
        //            }
        //            if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0")
        //            {
        //                objJsonResult.code = "0";
        //                objJsonResult.count = 0;
        //                objJsonResult.Message = "保存失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
        //                objJsonResult.data = null;
        //                return objJsonResult;
        //            }
        //            //=========================================================
        //            //主表
        //            string sql = $@"Insert Into Kf_ICStockBillMain
        //                (HInterID,HYear,HPeriod,HBillType,HBillSubType,HDate
           //             ,HBillNo,HBillStatus,HSupID,HManagerID,HEmpID,HDeptID,HSecManagerID,HKeeperID,HRemark,HMaker,HMakeDate,HCurID,HExRate,HWHID,HInnerBillNo,HExplanation )
        //                values(" + HInterID + "," + DateTime.Now.Year + "," + DateTime.Now.Month + ",'" + 1202 + "','" +
        //            HBillSubType + "','" + HDate + "','" + HBillNo + "'," + HBillStatus + "," + HSupID +
        //            "," + HManagerID + "," + HEmpID + "," + HDeptID + "," + HSecManagerID + "," + HKeeperID + ",'" + HRemark + "','" + HMaker +
        //            "',getdate()" + "," + HCurID + "," + HExRate + "," + HWHID + ",'" + HInnerBillNo + "','" + HExplanation + "')";
                    if (ds == null || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "保存前判断失败!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "保存失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //=========================================================
                    //主表
                    string sql = $@"Insert Into Kf_ICStockBillMain
                        (HInterID,HYear,HPeriod,HBillType,HBillSubType,HDate
                        ,HBillNo,HBillStatus,HSupID,HManagerID,HEmpID,HDeptID,HSecManagerID,HKeeperID,HRemark,HMaker,HMakeDate,HCurID,HExRate,HWHID,HInnerBillNo,HExplanation )
                        values(" + HInterID + "," + DateTime.Now.Year + "," + DateTime.Now.Month + ",'" + 1245 + "','" +
                    HBillSubType + "','" + HDate + "','" + HBillNo + "'," + HBillStatus + "," + HSupID +
                    "," + HManagerID + "," + HEmpID + "," + HDeptID + "," + HSecManagerID + "," + HKeeperID + ",'" + HRemark + "','" + HMaker +
                    "',getdate()" + "," + HCurID + "," + HExRate + "," + HWHID + ",'" + HInnerBillNo + "','" + HExplanation + "')";
        //            oCN.RunProc(sql);
                    oCN.RunProc(sql);
        //        }
        //        else if (OperationType == 3 || ds.Tables[0].Rows.Count != 0)
        //        { //修改
        //            string sql = $@"update Kf_ICStockBillMain  set " +
        //                        "HRemark='" + HRemark + "', HUpDater ='" + HMaker + "', HUpDateDate=getdate()" +
        //                         ",HSupID=" + HSupID + ",HCurID=" + HCurID
        //                         + ",HExRate=" + HExRate + ",HEmpID=" + HEmpID + ",HManagerID=" + HManagerID + ",HDeptID=" + HDeptID
        //                         + ",HInnerBillNo='" + HInnerBillNo + "' where HInterID=" + HInterID;
                }
                else if (OperationType == 3 || ds.Tables[0].Rows.Count != 0)
                { //修改
                    string sql = $@"update Kf_ICStockBillMain  set " +
                                "HRemark='" + HRemark + "', HUpDater ='" + HMaker + "', HUpDateDate=getdate()" +
                                 ",HSupID=" + HSupID + ",HCurID=" + HCurID
                                 + ",HExRate=" + HExRate + ",HEmpID=" + HEmpID + ",HManagerID=" + HManagerID + ",HDeptID=" + HDeptID
                                 + ",HInnerBillNo='" + HInnerBillNo + "' where HInterID=" + HInterID;
        //            oCN.RunProc(sql);
                    oCN.RunProc(sql);
        //            //删除子表
        //            oCN.RunProc("delete from Kf_ICStockBillSub where HInterID='" + HInterID + "'");
        //        }
        //        //保存子表
        //        objJsonResult = AddBillSub(msg3, HInterID, OperationType, user);
                    //删除子表
                    oCN.RunProc("delete from Kf_ICStockBillSub where HInterID='" + HInterID + "'");
                }
                //保存子表
                objJsonResult = AddBillSub(msg3, HInterID, OperationType, user);
        //        //生产入库单新增回填生产订单关联数量
        //        oCN.RunProc("exec h_p_Kf_UpDateRelation_ProductInToICMO_Add " + HInterID);
                //生产退库单新增回填生产订单关联数量
                oCN.RunProc("exec h_p_Sc_UpDateRelation_ProductionReturnToICMO_Add " + HInterID);
        //        //生产入库单新增回填生产汇报单关联数量
        //        oCN.RunProc("exec h_p_Kf_UpDateRelation_ProductInToICMOReport_Add " + HInterID);
                //生产退库单新增回填生产汇报单关联数量
                oCN.RunProc("exec h_p_Sc_UpDateRelation_ProductionReturnToICMOReport_Add " + HInterID);
        //        if (objJsonResult.code == "0")
        //        {
        //            objJsonResult.code = "0";
        //            objJsonResult.count = 0;
        //            objJsonResult.Message = objJsonResult.Message;
        //            objJsonResult.data = null;
        //            return objJsonResult;
        //        }
                if (objJsonResult.code == "0")
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = objJsonResult.Message;
                    objJsonResult.data = null;
                    return objJsonResult;
                }
        //        objJsonResult.code = "1";
        //        objJsonResult.count = 1;
        //        objJsonResult.Message = null;
        //        objJsonResult.data = null;
        //        return objJsonResult;
        //    }
        //    catch (Exception e)
        //    {
        //        objJsonResult.code = "0";
        //        objJsonResult.count = 0;
        //        objJsonResult.Message = "Exception!" + e.ToString();
        //        objJsonResult.data = null;
        //        return objJsonResult;
        //    }
        //}
                objJsonResult.code = "1";
                objJsonResult.count = 1;
                objJsonResult.Message = null;
                objJsonResult.data = null;
                return objJsonResult;
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "Exception!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        //public json AddBillSub(string msg3, long HInterID, int OperationType, string user)
        //{
        //    List<ClsKf_ProductInBillSub> DetailColl = Newtonsoft.Json.JsonConvert.DeserializeObject<List<ClsKf_ProductInBillSub>>(msg3);
        public json AddBillSub(string msg3, long HInterID, int OperationType, string user)
        {
            List<ClsSc_ProductionReturnBillSub> DetailColl = Newtonsoft.Json.JsonConvert.DeserializeObject<List<ClsSc_ProductionReturnBillSub>>(msg3);
        //    List<ClsKf_ProductInBillSub> DetailColl2 = Newtonsoft.Json.JsonConvert.DeserializeObject<List<ClsKf_ProductInBillSub>>(msg3);
            List<ClsSc_ProductionReturnBillSub> DetailColl2 = Newtonsoft.Json.JsonConvert.DeserializeObject<List<ClsSc_ProductionReturnBillSub>>(msg3);
        //    //long HSPID = DetailColl2[0].HSPID == null ? 0 : DetailColl2[0].HSPID;
        //    long HSourceInterID = DetailColl2[0].HSourceInterID == null ? 0 : DetailColl2[0].HSourceInterID;
        //    long HSourceEntryID = DetailColl2[0].HSourceEntryID == null ? 0 : DetailColl2[0].HSourceEntryID;
        //    string HSourceBillNo = DetailColl2[0].HSourceBillNo == null ? "''" : DetailColl2[0].HSourceBillNo;
        //    string HSourceBillType = DetailColl2[0].HSourceBillType == null ? "''" : DetailColl2[0].HSourceBillType;
        //    string HRemark = DetailColl2[0].HRemark == null ? "''" : DetailColl2[0].HRemark;
        //    string HPOOrderBillNo = DetailColl2[0].HPOOrderBillNo == null ? "''" : DetailColl2[0].HPOOrderBillNo;
            //long HSPID = DetailColl2[0].HSPID == null ? 0 : DetailColl2[0].HSPID;
            long HSourceInterID = DetailColl2[0].HSourceInterID == null ? 0 : DetailColl2[0].HSourceInterID;
            long HSourceEntryID = DetailColl2[0].HSourceEntryID == null ? 0 : DetailColl2[0].HSourceEntryID;
            string HSourceBillNo = DetailColl2[0].HSourceBillNo == null ? "''" : DetailColl2[0].HSourceBillNo;
            string HSourceBillType = DetailColl2[0].HSourceBillType == null ? "''" : DetailColl2[0].HSourceBillType;
            string HRemark = DetailColl2[0].HRemark == null ? "''" : DetailColl2[0].HRemark;
            string HPOOrderBillNo = DetailColl2[0].HPOOrderBillNo == null ? "''" : DetailColl2[0].HPOOrderBillNo;
        //    int i = 0;
        //    foreach (ClsKf_ProductInBillSub oSub in DetailColl)
        //    {
        //        i++;
        //        if (oSub.HQty <= 0 || oSub.HQty == null)
        //        {
        //            objJsonResult.code = "0";
        //            objJsonResult.count = 0;
        //            objJsonResult.Message = "第" + i + "行,数量不能为0或者小于0";
        //            objJsonResult.data = null;
        //            return objJsonResult;
        //        }
            int i = 0;
            foreach (ClsSc_ProductionReturnBillSub oSub in DetailColl)
            {
                i++;
                if (oSub.HQty <= 0 || oSub.HQty == null)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "第" + i + "行,数量不能为0或者小于0";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
        //        if (oSub.HMaterID == 0)
        //        {
        //            objJsonResult.code = "0";
        //            objJsonResult.count = 0;
        //            objJsonResult.Message = "第" + i + "行,物料不能为空";
        //            objJsonResult.data = null;
        //            return objJsonResult;
        //        }
                if (oSub.HMaterID == 0)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "第" + i + "行,物料不能为空";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
        //        //if (oSub.HSourceID == 0)
        //        //{
        //        //    objJsonResult.code = "0";
        //        //    objJsonResult.count = 0;
        //        //    objJsonResult.Message = "第" + i + "行,生产资源不能为空";
        //        //    objJsonResult.data = null;
        //        //    return objJsonResult;
        //        //}
                //if (oSub.HSourceID == 0)
                //{
                //    objJsonResult.code = "0";
                //    objJsonResult.count = 0;
                //    objJsonResult.Message = "第" + i + "行,生产资源不能为空";
                //    objJsonResult.data = null;
                //    return objJsonResult;
                //}
        //        if (oSub.HUnitID == 0)
        //        {
        //            objJsonResult.code = "0";
        //            objJsonResult.count = 0;
        //            objJsonResult.Message = "第" + i + "行,计量单位不能为空";
        //            objJsonResult.data = null;
        //            return objJsonResult;
        //        }
                if (oSub.HUnitID == 0)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "第" + i + "行,计量单位不能为空";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
        //        DataSet Cs;
        //        Int64 NewHEntryID = 1;
        //        Cs = oCN.RunProcReturn("select MAX(HEntryID)HEntryID from Kf_ICStockBillSub", "Kf_ICStockBillSub");
        //        if (Cs.Tables[0].Rows.Count != 0 && ClsPub.isLong(Cs.Tables[0].Rows[0]["HEntryID"].ToString()) != 0)
        //        {
        //            NewHEntryID = ClsPub.isLong(Cs.Tables[0].Rows[0]["HEntryID"].ToString());
        //            NewHEntryID += 1;
        //        }
                DataSet Cs;
                Int64 NewHEntryID = 1;
                Cs = oCN.RunProcReturn("select MAX(HEntryID)HEntryID from Kf_ICStockBillSub", "Kf_ICStockBillSub");
                if (Cs.Tables[0].Rows.Count != 0 && ClsPub.isLong(Cs.Tables[0].Rows[0]["HEntryID"].ToString()) != 0)
                {
                    NewHEntryID = ClsPub.isLong(Cs.Tables[0].Rows[0]["HEntryID"].ToString());
                    NewHEntryID += 1;
                }
        //        oCN.RunProc($@"Insert into Kf_ICStockBillSub
        //        (HInterID,HEntryID,HMaterID,HUnitID,HQtyMust,HQty,HPrice
           //     ,HMoney,HWHID,HSPID,HRemark,HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HPOOrderInterID
        //        ,HPOOrderEntryID,HPOORderBillNo,HSecUnitID,HSeOrderInterID,HSeOrderEntryID,HSeOrderBillNo,HRelationQty,HSecUnitRate,HPropertyID)
        //         values({HInterID},{NewHEntryID},{oSub.HMaterID},{oSub.HUnitID},{(oSub.HQtyMust == null ? 0 : oSub.HQtyMust)},{(oSub.HQty == null ? 0 : oSub.HQty)}
        //        ,{oSub.HPrice},{oSub.HMoney},{oSub.HWHID},{oSub.HSPID},'{HRemark}',{oSub.HSourceInterID},{oSub.HSourceEntryID},'{HSourceBillNo}',{HSourceBillType},
        //        {oSub.HPOOrderInterID},{oSub.HPOOrderEntryID},'{HPOOrderBillNo}',{oSub.HSecUnitID},{oSub.HSeOrderInterID},{oSub.HSeOrderEntryID},'{oSub.HSeOrderBillNo}',{oSub.HRelationQty},{oSub.HSecUnitRate},{oSub.HSecUnitRate})");
                oCN.RunProc($@"Insert into Kf_ICStockBillSub
                (HInterID,HEntryID,HMaterID,HUnitID,HQtyMust,HQty,HPrice
                ,HMoney,HWHID,HSPID,HRemark,HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HPOOrderInterID
                ,HPOOrderEntryID,HPOORderBillNo,HSecUnitID,HSeOrderInterID,HSeOrderEntryID,HSeOrderBillNo,HRelationQty,HSecUnitRate,HPropertyID)
                 values({HInterID},{NewHEntryID},{oSub.HMaterID},{oSub.HUnitID},{(oSub.HQtyMust == null ? 0 : oSub.HQtyMust)},{(oSub.HQty == null ? 0 : oSub.HQty)}
                ,{oSub.HPrice},{oSub.HMoney},{oSub.HWHID},{oSub.HSPID},'{HRemark}',{oSub.HSourceInterID},{oSub.HSourceEntryID},'{HSourceBillNo}',{HSourceBillType},
                {oSub.HPOOrderInterID},{oSub.HPOOrderEntryID},'{HPOOrderBillNo}',{oSub.HSecUnitID},{oSub.HSeOrderInterID},{oSub.HSeOrderEntryID},'{oSub.HSeOrderBillNo}',{oSub.HRelationQty},{oSub.HSecUnitRate},{oSub.HSecUnitRate})");
        //    }
        //    //保存后控制=========================================
        //    ds = oCN.RunProcReturn("exec h_p_Kf_ProductInBill_AfterSaveCtrl " + HInterID, "h_p_Kf_ProductInBill_AfterSaveCtrl");
            }
            //保存后控制=========================================
            ds = oCN.RunProcReturn("exec h_p_Sc_ProductionReturnBill_AfterSaveCtrl " + HInterID, "h_p_Sc_ProductionReturnBill_AfterSaveCtrl");
        //    if (ds == null || ds.Tables[0].Rows.Count == 0)
        //    {
        //        objJsonResult.code = "0";
        //        objJsonResult.count = 0;
        //        objJsonResult.Message = "保存后判断失败!";
        //        objJsonResult.data = null;
        //        return objJsonResult;
        //    }
        //    if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0")
        //    {
        //        objJsonResult.code = "0";
        //        objJsonResult.count = 0;
        //        objJsonResult.Message = "保存失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
        //        objJsonResult.data = null;
        //        return objJsonResult;
        //    }
        //    //=========================================================
            if (ds == null || ds.Tables[0].Rows.Count == 0)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "保存后判断失败!";
                objJsonResult.data = null;
                return objJsonResult;
            }
            if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0")
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "保存失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                objJsonResult.data = null;
                return objJsonResult;
            }
            //=========================================================
        //    objJsonResult.code = "1";
        //    objJsonResult.count = 1;
        //    objJsonResult.Message = null;
        //    objJsonResult.data = null;
        //    return objJsonResult;
        //}
        //#endregion
            objJsonResult.code = "1";
            objJsonResult.count = 1;
            objJsonResult.Message = null;
            objJsonResult.data = null;
            return objJsonResult;
        }
        #endregion
        #region ç”Ÿäº§é€€åº“单 å®¡æ ¸/反审核
        /// <summary>
        ///
        /// </summary>
        /// <param name="HInterID">单据ID</param>
        /// <param name="IsAudit">审核(0),反审核(1)</param>
@@ -462,67 +506,58 @@
        /// <returns></returns>
        [Route("Sc_ProductionReturn/AuditSc_ProductionReturn")]
        [HttpGet]
        public object AuditSc_ProductionReturn(string HInterID, int Type, string user)
        public object AuditSc_ProductionReturn(int HInterID, int IsAudit, string CurUserName)
        {
            string ModRightNameCheck = "Kf_ProductionReturnBill_Check";
            DBUtility.ClsPub.CurUserName = CurUserName;
            try
            {
                //判断是否有审核权限
                if (!DBUtility.ClsPub.Security_Log("Sc_ProductionReturn_Check", 1, false, user))
                //审核权限
                if (!DBUtility.ClsPub.Security_Log_second(ModRightNameCheck, 1, false, CurUserName))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "无权限审核!";
                    objJsonResult.Message = "审核失败!无权限!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                //HInterID数据判断
                if (HInterID <= 0)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "HInterID小于0!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                if (string.IsNullOrWhiteSpace(HInterID))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "HInterID为空!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                ClsPub.CurUserName = user;
                BillOld.MvarItemKey = "Kf_ICStockBillMain";
                oCN.BeginTran();//开始事务
                Int64 lngBillKey = 0;
                lngBillKey = DBUtility.ClsPub.isLong(HInterID);                                         //对HInterID进行类型的转换
                DAL.ClsSc_ProductionReturnBill oBill = new DAL.ClsSc_ProductionReturnBill();                              //实例化单据操作类,用于进行相关操作
                //Type 1 å®¡æ ¸  2  åå®¡æ ¸
                if (Type == 1)
                //针对需要进行的操作,检验当前单据的状态是否支持需要进行的操作
                if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo))                    //根据HInterID获取该单据的数据
                {
                    //判断单据是否已经审核
                    DataSet ds;
                    string sql = "select * from " + BillOld.MvarItemKey + " where HinterID = " + HInterID;
                    ds = oCN.RunProcReturn(sql, BillOld.MvarItemKey);
                    if (ds == null || ds.Tables[0].Rows.Count == 0)
                    if (oBill.omodel.HCloseMan.Trim() != "")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "单据不存在!";
                        objJsonResult.Message = "单据已关闭!不能再次审核!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0)
                    if (oBill.omodel.HDeleteMan.Trim() != "")
                    {
                        if (ds.Tables[0].Rows[0]["HCloseMan"] != null && ds.Tables[0].Rows[0]["HCloseMan"].ToString() != "")
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "单据已关闭!不能再次审核!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                        if (ds.Tables[0].Rows[0]["HDeleteMan"] != null && ds.Tables[0].Rows[0]["HDeleteMan"].ToString() != "")
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "单据已作废!不能再次审核!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                        if (ds.Tables[0].Rows[0]["HChecker"] != null && ds.Tables[0].Rows[0]["HChecker"].ToString() != "")
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "单据已作废!不能再次审核!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (IsAudit == 0)  //审核判断
                    {
                        if (oBill.omodel.HChecker.Trim() != "")
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
@@ -530,42 +565,10 @@
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                        //审核单据
                        if (!BillOld.CheckBill(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo))
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 1;
                            objJsonResult.Message = "审核失败!原因:" + ClsPub.sExeReturnInfo;
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                    }
                }
                else
                {
                    //判断单据是否已经反审核
                    DataSet ds;
                    string sql = "select * from " + BillOld.MvarItemKey + " where HinterID = " + HInterID;
                    ds = oCN.RunProcReturn(sql, BillOld.MvarItemKey);
                    if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0)
                    if (IsAudit == 1) //反审核判断
                    {
                        if (ds.Tables[0].Rows[0]["HCloseMan"] != null && ds.Tables[0].Rows[0]["HCloseMan"].ToString() != "")
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "单据已关闭!不能进行反审核!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                        if (ds.Tables[0].Rows[0]["HDeleteMan"] != null && ds.Tables[0].Rows[0]["HDeleteMan"].ToString() != "")
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "单据已作废!不能进行反审核!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                        if (ds.Tables[0].Rows[0]["HChecker"] == null || ds.Tables[0].Rows[0]["HChecker"].ToString() == "")
                        if (oBill.omodel.HChecker.Trim() == "")
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
@@ -573,32 +576,109 @@
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                        //反审核单据
                        if (!BillOld.AbandonCheck(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo))
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 1;
                            objJsonResult.Message = "反审核失败!原因:" + ClsPub.sExeReturnInfo;
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                    }
                }
                else
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "单据不存在!原因:" + DBUtility.ClsPub.sExeReturnInfo;
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                oCN.Commit();//提交事务
                objJsonResult.code = "0";
                objJsonResult.count = 1;
                objJsonResult.Message = "执行成功!";
                objJsonResult.data = null;
                return objJsonResult; ;
                //进行需要进行的审核/反审核操作
                if (IsAudit == 0) //审核提交
                {
                    //审核前控制=========================================
                    string sql1 = "exec h_p_Sc_ProductionReturnBill_BeforeCheckCtrl " + oBill.omodel.HInterID + ",'" + oBill.omodel.HBillNo + "','" + CurUserName + "'";
                    ds = oCN.RunProcReturn(sql1, "h_p_Sc_ProductionReturnBill_BeforeCheckCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "审核失败!原因:审核前判断失败,请与网络管理人员联系";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //==================================================================================
                    //审核提交
                    if (oBill.CheckBill(oBill.omodel.HInterID, oBill.omodel.HBillNo, "h_p_Sc_ProductionReturnBill_AfterCheckCtrl", CurUserName, ref DBUtility.ClsPub.sExeReturnInfo) == true)
                    {
                        objJsonResult.code = "1";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "审核成功";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    else
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "审核失败!原因:" + DBUtility.ClsPub.sExeReturnInfo;
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                }
                if (IsAudit == 1) //反审核提交
                {
                    //反审核前控制=========================================
                    DataSet ds = oCN.RunProcReturn("Exec h_p_Sc_ProductionReturnBill_BeforeUnCheckCtrl " + oBill.omodel.HInterID + ",'" + oBill.omodel.HBillNo + "','" + CurUserName + "'", "h_p_Sc_ProductionReturnBill_BeforeUnCheckCtrl");
                    if (ds == null)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "反审核失败!原因:" + "反审核前判断失败!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "反审核失败!原因:" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //=========================================================
                    //反审核提交AbandonCheck
                    if (oBill.AbandonCheck(oBill.omodel.HInterID, oBill.omodel.HBillNo, "h_p_Sc_ProductionReturnBill_AfterUnCheckCtrl", CurUserName, ref DBUtility.ClsPub.sExeReturnInfo) == true)
                    {
                        objJsonResult.code = "1";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反审核成功";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    else
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "反审核失败!原因:" + DBUtility.ClsPub.sExeReturnInfo;
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                }
                return objJsonResult;
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "执行失败!" + e.ToString();
                objJsonResult.Message = "审核失败或者反审核失败!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
@@ -613,7 +693,7 @@
            try
            {
                //判断是否有删除权限
                if (!DBUtility.ClsPub.Security_Log("Sc_ProductionReturn_Close", 1, false, user))
                if (!DBUtility.ClsPub.Security_Log("Kf_ProductionReturnBill_Close", 1, false, user))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
@@ -752,8 +832,7 @@
        }
        #endregion
        #region é‡‡è´­å…¥åº“单 ä½œåºŸ/反作废功能
        #region ç”Ÿäº§é€€åº“单 ä½œåºŸ/反作废功能
        [Route("Sc_ProductionReturn/DropSc_ProductionReturn")]
        [HttpGet]
        public object DropSc_ProductionReturn(string HInterID, int Type, string user)
@@ -761,7 +840,7 @@
            try
            {
                //判断是否有作废权限
                if (!DBUtility.ClsPub.Security_Log("Sc_ProductionReturn_Delete", 1, false, user))
                if (!DBUtility.ClsPub.Security_Log("Kf_ProductionReturnBill_Delete", 1, false, user))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
@@ -882,5 +961,28 @@
            }
        }
        #endregion
        #region æ ¹æ®ç‰©æ–™å†…码获取物料信息
        [Route("Sc_ProductionReturnBill/getMaterialByMaterID")]
        [HttpGet]
        public ApiResult<DataTable> getMaterialByMaterID(Int64 HMaterID)
        {
            SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
            string sql = "select a.HItemID HMaterID,a.HNumber HMaterNumber,a.HName HMaterName,a.HMaterRuleType,a.HModel HMaterModel,a.HUnitID, b.HNumber HUnitNumber, b.HName HUnitName" +
                " from Gy_Material AS a " +
                " LEFT OUTER JOIN Gy_Unit AS b on a.HUnitID = b.HItemID " +
                " where a.HItemID =" + HMaterID;
            var dataSet = oCN.RunProcReturn(sql, "Gy_Material");
            if (dataSet == null || dataSet.Tables[0].Rows.Count == 0)
                return new ApiResult<DataTable> { code = -1, msg = "不存在该物料" };
            return new ApiResult<DataTable> { code = 1, msg = "查询成功", data = dataSet.Tables[0] };
        }
        #endregion
    }
}
WebAPI/Controllers/Sc_ProcessMangementController.cs
@@ -7562,5 +7562,860 @@
        #endregion
        #region ä¸è‰¯å“è¯„审结论单
        #region ä¸è‰¯å“è¯„审结论单 æ–°å¢ž/编辑
        [Route("Sc_ProcessMangement/SaveQC_NoPassProdConclusionBill")]
        [HttpPost]
        public object SaveQC_NoPassProdConclusionBill([FromBody] JObject msg)
        {
            var _value = msg["msg"].ToString();
            string msg1 = _value.ToString();
            string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
            string msg2 = sArray[0].ToString();
            //string msg3 = sArray[1].ToString(); //子表
            string refSav = sArray[1].ToString();//操作方式数据类型 1添加 3修改 2 å¤åˆ¶
            string msg4 = sArray[2].ToString();//用户名
            DBUtility.ClsPub.CurUserName = msg4;
            string UserName = "";
            string s = "";
            ListModels oListModels = new ListModels();
            try
            {
                //编辑权限
                if (!DBUtility.ClsPub.Security_Log_second("QC_NoPassProdConclusionBillMain_Edit", 1, false, msg4))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "无保存权限!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                // QC_NoPassProdConclusionBill
                DAL.ClsQC_NoPassProdConclusionBill oBill = new DAL.ClsQC_NoPassProdConclusionBill();
                List<Model.ClsQC_NoPassProdConclusionBillMain> lsmain = new List<Model.ClsQC_NoPassProdConclusionBillMain>();
                msg2 = msg2.Replace("\\", "");
                msg2 = msg2.Replace("\n", "");  //\n
                lsmain = oListModels.getObjectByJson_QC_NoPassProdConclusionBill(msg2);
                foreach (Model.ClsQC_NoPassProdConclusionBillMain oItem in lsmain)
                {
                    if (refSav == "Add")
                    {
                        //单据号是否重复
                        if (oBill.IsExistBillNo(ref ClsPub.sExeReturnInfo, oItem.HBillNo, BillStatus, BillOld.omodel.HInterID))
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "单据号重复!不允许保存!";
                            objJsonResult.data = 1;
                            return objJsonResult;
                        }
                    }
                    if (refSav == "Update")
                    {
                        if (oBill.ShowBill(oItem.HInterID, ref s) == false)
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "此单据有误!";
                            objJsonResult.data = 1;
                            return objJsonResult;
                        }
                        //判断是否可编辑
                        if (oBill.omodel.HChecker != "" && oBill.omodel.HChecker != null)
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "此单据已经被审核,不允许修改!";
                            objJsonResult.data = 1;
                            return objJsonResult;
                        }
                        if (oBill.omodel.HBillStatus > 1)
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "此单据处于不可编辑状态,不允许修改!";
                            objJsonResult.data = 1;
                            return objJsonResult;
                        }
                        if (!DBUtility.Xt_BaseBillFun.Fun_AllowEditBill(oBill, ref s))
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = s + ",不允许修改";
                            objJsonResult.data = 1;
                            return objJsonResult;
                        }
                    }
                    UserName = oItem.HMaker;  //制单人
                    oItem.HBillType = "7513";
                    oItem.HBillSubType = "7513";
                    oItem.HYear = DBUtility.ClsPub.isLong(DateTime.Now.Year);
                    oItem.HPeriod = DBUtility.ClsPub.isLong(DateTime.Now.Month);
                    oItem.HMakeDate = DBUtility.ClsPub.isStrNull(DateTime.Now.ToString("yyyy-MM-dd"));
                    if (DBUtility.ClsPub.isStrNull(oItem.HDate) == "")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "保存失败!没有单据日期,无法保存!";
                        objJsonResult.data = 1;
                        return objJsonResult;
                    }
                    oBill.omodel = oItem;
                }
                //保存
                //保存完毕后验收
                bool bResult;
                if (refSav == "Add")
                {
                    bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo);
                }
                else if (refSav == "Update")
                {
                    bResult = oBill.ModifyBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo);
                }
                else
                {
                    bResult = false;
                }
                if (bResult)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "保存成功!";
                    objJsonResult.data = 1;
                    return objJsonResult;
                }
                else
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "保存失败!" + DBUtility.ClsPub.sExeReturnInfo;
                    objJsonResult.data = 1;
                    return objJsonResult;
                }
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "保存失败!" + e.ToString();
                objJsonResult.data = 1;
                return objJsonResult;
            }
        }
        #endregion
        #region ä¸è‰¯å“è¯„审结论单 ç¼–辑回显列表
        [Route("Sc_ProcessMangement/Edit_QC_NoPassProdConclusionBill")]
        [HttpGet]
        public object Edit_QC_NoPassProdConclusionBill(string HID)
        {
            try
            {
                List<object> columnNameList = new List<object>();
                string sql = "select * from h_v_QC_NoPassProdConclusionBillMain_Edit where hmainid='" + HID + "'";
                ds = oCN.RunProcReturn(sql, "h_v_QC_NoPassProdConclusionBillMain_Edit");
                //添加列名
                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 = "Sucess!";
                objJsonResult.data = ds.Tables[0];
                objJsonResult.list = columnNameList;
                return objJsonResult;
            }
            catch (Exception ex)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "查询数据异常,请与管理员联系!" + ex.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
        #region ä¸è‰¯å“è¯„审结论单 åˆ—表
        [Route("Sc_ProcessMangement/Get_QC_NoPassProdConclusionBillList")]
        [HttpGet]
        public object Get_QC_NoPassProdConclusionBillList(string sWhere, string user)
        {
            try
            {
                List<object> columnNameList = new List<object>();
                //查看权限
                if (!DBUtility.ClsPub.Security_Log("QC_NoPassProdConclusionBillMain_Query", 1, false, user))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "无查看权限!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                if (sWhere == null || sWhere.Equals(""))
                {
                    string sql = "select * from h_v_QC_NoPassProdConclusionBillMainList order by å•据号 desc";
                    ds = oCN.RunProcReturn(sql, "h_v_QC_NoPassProdConclusionBillMainList");
                }
                else
                {
                    string sql1 = "select * from h_v_QC_NoPassProdConclusionBillMainList where 1 = 1 ";
                    string sql = sql1 + sWhere + " order by å•据号 desc";
                    ds = oCN.RunProcReturn(sql, "h_v_QC_NoPassProdConclusionBillMainList");
                }
                //添加列名
                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 = "Sucess!";
                objJsonResult.data = ds.Tables[0];
                objJsonResult.list = columnNameList;
                return objJsonResult;
            }
            catch (Exception ex)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "查询数据异常,请与管理员联系!" + ex.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
        #region ä¸è‰¯å“è¯„审结论单 åˆ é™¤
        [Route("Sc_ProcessMangement/DeleteQC_NoPassProdConclusionBill")]
        [HttpGet]
        public object DeleteQC_NoPassProdConclusionBill(string HInterID, string user)
        {
            try
            {
                string s = "";
                DAL.ClsQC_NoPassProdConclusionBill BillOld = new DAL.ClsQC_NoPassProdConclusionBill();
                //查看权限
                if (!DBUtility.ClsPub.Security_Log("QC_NoPassProdConclusionBillMain_Delete", 1, false, user))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "无删除权限!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                if (HInterID == null || HInterID.Equals(""))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "HInterID不能为空!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                if (BillOld.ShowBill(long.Parse(HInterID), ref s) == false)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "此单据有误!";
                    objJsonResult.data = 1;
                    return objJsonResult;
                }
                //判断是否可删除
                if (BillOld.omodel.HChecker != "" && BillOld.omodel.HChecker != null)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "此单据已经被审核,不允许删除!";
                    objJsonResult.data = 1;
                    return objJsonResult;
                }
                //删除前控制=========================================
                string sql1 = "exec h_p_QC_NoPassProdConclusionBill_BeforeDelCtrl " + BillOld.omodel.HInterID + ",'" + BillOld.omodel.HBillNo + "','" + user + "'";
                ds = oCN.RunProcReturn(sql1, "h_p_QC_NoPassProdConclusionBill_BeforeDelCtrl");
                if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "删除失败!原因:删除前判断失败,请与网络管理人员联系";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "删除失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                //==================================================================================
                oCN.BeginTran();
                oCN.RunProc("delete from QC_NoPassProdConclusionBillMain where HInterID = " + HInterID);
                oCN.RunProc("delete from QC_NoPassProdConclusionBillSub where HInterID= " + HInterID);
                //删除后控制==================================================================================
                string sql2 = "exec h_p_QC_NoPassProdConclusionBill_AfterDelCtrl " + BillOld.omodel.HInterID + ",'" + BillOld.omodel.HBillNo + "','" + user + "'";
                ds = oCN.RunProcReturn(sql2, "h_p_QC_NoPassProdConclusionBill_AfterDelCtrl");
                if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                {
                    s = "删除后判断失败,请与网络管理人员联系";
                    objJsonResult.code = "0";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "删除失败!原因:" + s;
                    objJsonResult.data = null;
                    oCN.RollBack();
                    return objJsonResult;
                }
                if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                {
                    s = ds.Tables[0].Rows[0]["HRemark"].ToString();
                    objJsonResult.code = "0";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "删除失败!原因:" + s;
                    objJsonResult.data = null;
                    oCN.RollBack();
                    return objJsonResult;
                }
                //==============================================================================================
                oCN.Commit();
                objJsonResult.code = "1";
                objJsonResult.count = 1;
                objJsonResult.Message = "删除成功";
                objJsonResult.data = null;
                return objJsonResult;
            }
            catch (Exception e)
            {
                oCN.RollBack();
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "Exception!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
        #region ä¸è‰¯å“è¯„审结论单 å®¡æ ¸/反审核
        /// <summary>
        /// </summary>
        /// <param name="HInterID">单据ID</param>
        /// <param name="IsAudit">审核(0),反审核(1)</param>
        /// <param name="CurUserName">审核人</param>
        /// <returns></returns>
        [Route("Sc_ProcessMangement/AuditQC_NoPassProdConclusionBill")]
        [HttpGet]
        public object AuditQC_NoPassProdConclusionBill(int HInterID, int IsAudit, string CurUserName)
        {
            string ModRightNameCheck = "QC_NoPassProdConclusionBillMain_Check";
            DBUtility.ClsPub.CurUserName = CurUserName;
            try
            {
                //审核权限
                if (!DBUtility.ClsPub.Security_Log_second(ModRightNameCheck, 1, false, CurUserName))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "审核失败!无权限!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                //HInterID数据判断
                if (HInterID <= 0)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "HInterID小于0!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                Int64 lngBillKey = 0;
                lngBillKey = DBUtility.ClsPub.isLong(HInterID);                                         //对HInterID进行类型的转换
                DAL.ClsQC_NoPassProdConclusionBill oBill = new DAL.ClsQC_NoPassProdConclusionBill();               //实例化单据操作类,用于进行相关操作
                //针对需要进行的操作,检验当前单据的状态是否支持需要进行的操作
                if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo))                    //根据HInterID获取该单据的数据
                {
                    if (oBill.omodel.HCloseMan.Trim() != "")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "单据已关闭!不能再次审核!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (oBill.omodel.HDeleteMan.Trim() != "")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "单据已作废!不能再次审核!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (IsAudit == 0)  //审核判断
                    {
                        if (oBill.omodel.HChecker.Trim() != "")
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "单据已审核!不能再次审核!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                    }
                    if (IsAudit == 1) //反审核判断
                    {
                        if (oBill.omodel.HChecker.Trim() == "")
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "单据未审核!不需要反审核!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                    }
                }
                else
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "单据不存在!原因:" + DBUtility.ClsPub.sExeReturnInfo;
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                //进行需要进行的审核/反审核操作
                if (IsAudit == 0) //审核提交
                {
                    oCN.BeginTran();
                    //记录返回信息
                    string msg = "";
                    //审核前控制=========================================
                    string sql1 = "exec h_p_QC_NoPassProdConclusionBill_BeforeCheckCtrl " + oBill.omodel.HInterID + ",'" + oBill.omodel.HBillNo + "','" + CurUserName + "'";
                    ds = oCN.RunProcReturn(sql1, "h_p_QC_NoPassProdConclusionBill_BeforeCheckCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "审核失败!原因:审核前判断失败,请与网络管理人员联系";
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    //==================================================================================
                    //审核提交
                    if (oBill.CheckBill(oBill.omodel.HInterID, oBill.omodel.HBillNo, "h_p_QC_NoPassProdConclusionBill_AfterCheckCtrl", CurUserName, ref DBUtility.ClsPub.sExeReturnInfo) == true)
                    {
                        oCN.Commit();
                        objJsonResult.code = "1";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "审核成功!" + msg;
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    else
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "审核失败!原因:" + DBUtility.ClsPub.sExeReturnInfo;
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                }
                if (IsAudit == 1) //反审核提交
                {
                    //反审核前控制=========================================
                    string sql1 = "exec h_p_QC_NoPassProdConclusionBill_BeforeUnCheckCtrl " + oBill.omodel.HInterID + ",'" + oBill.omodel.HBillNo + "','" + CurUserName + "'";
                    ds = oCN.RunProcReturn(sql1, "h_p_QC_NoPassProdConclusionBill_BeforeUnCheckCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反审核失败!原因:反审核前判断失败,请与网络管理人员联系";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //===========================================================
                    //反审核提交AbandonCheck
                    if (oBill.AbandonCheck(oBill.omodel.HInterID, oBill.omodel.HBillNo, "h_p_QC_NoPassProdConclusionBill_AfterUnCheckCtrl", CurUserName, ref DBUtility.ClsPub.sExeReturnInfo) == true)
                    {
                        objJsonResult.code = "1";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反审核成功";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    else
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "反审核失败!原因:" + DBUtility.ClsPub.sExeReturnInfo;
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                }
                return objJsonResult;
            }
            catch (Exception e)
            {
                oCN.RollBack();
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "审核失败或者反审核失败!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
        #region ä¸è‰¯å“è¯„审结论单 å…³é—­/反关闭
        /// <summary>
        /// </summary>
        /// <param name="HInterID">单据ID</param>
        /// <param name="IsAudit">关闭(0),反关闭(1)</param>
        /// <param name="CurUserName">关闭人</param>
        /// <returns></returns>
        [Route("Sc_ProcessMangement/CloseQC_NoPassProdConclusionBill")]
        [HttpGet]
        public object CloseQC_NoPassProdConclusionBill(int HInterID, int IsAudit, string CurUserName)
        {
            string ModRightNameCheck = "QC_NoPassProdConclusionBillMain_Close";
            DBUtility.ClsPub.CurUserName = CurUserName;
            try
            {
                //检查权限
                if (!DBUtility.ClsPub.Security_Log_second(ModRightNameCheck, 1, false, CurUserName))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "关闭失败!无权限!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                //HInterID数据判断
                if (HInterID <= 0)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "HInterID小于0!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                Int64 lngBillKey = 0;
                lngBillKey = DBUtility.ClsPub.isLong(HInterID);                                         //对HInterID进行类型的转换
                DAL.ClsQC_NoPassProdConclusionBill oBill = new DAL.ClsQC_NoPassProdConclusionBill();             //实例化单据操作类,用于进行相关操作
                //针对需要进行的操作,检验当前单据的状态是否支持需要进行的操作
                if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo))                    //根据HInterID获取该单据的数据
                {
                    if (oBill.omodel.HDeleteMan.Trim() != "")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "单据已作废!不能进行关闭!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (oBill.omodel.HChecker.Trim() == "")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "单据未审核!不能进行关闭!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (IsAudit == 0)  //关闭判断
                    {
                        if (oBill.omodel.HCloseMan.Trim() != "")
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "单据已关闭!不能再次关闭!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                    }
                    if (IsAudit == 1) //反关闭判断
                    {
                        if (oBill.omodel.HCloseMan.Trim() == "")
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "单据未关闭!不需要反关闭!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                    }
                }
                else
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "单据不存在!原因:" + DBUtility.ClsPub.sExeReturnInfo;
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                //进行需要进行的关闭/反关闭操作
                if (IsAudit == 0) //关闭提交
                {
                    //关闭提交
                    if (oBill.CloseBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo) == true)
                    {
                        objJsonResult.code = "1";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "关闭成功";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    else
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "关闭失败!原因:" + DBUtility.ClsPub.sExeReturnInfo;
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                }
                if (IsAudit == 1) //反关闭提交
                {
                    //反关闭提交
                    if (oBill.CancelClose(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo) == true)
                    {
                        objJsonResult.code = "1";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反关闭成功";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    else
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "反关闭失败!原因:" + DBUtility.ClsPub.sExeReturnInfo;
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                }
                return objJsonResult;
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "关闭失败或者反关闭失败!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
        #region ä¸è‰¯å“è¯„审结论单  ä½œåºŸ/反作废
        /// <summary>
        /// </summary>
        /// <param name="HInterID">单据ID</param>
        /// <param name="IsAudit">作废(0),反作废(1)</param>
        /// <param name="CurUserName">作废人</param>
        /// <returns></returns>
        [Route("Sc_ProcessMangement/DeleteQC_NoPassProdConclusionBill")]
        [HttpGet]
        public object DeleteQC_NoPassProdConclusionBill(int HInterID, int IsAudit, string CurUserName)
        {
            string ModRightNameCheck = "QC_NoPassProdConclusionBillMain_Drop";
            DBUtility.ClsPub.CurUserName = CurUserName;
            try
            {
                //检查权限
                if (!DBUtility.ClsPub.Security_Log_second(ModRightNameCheck, 1, false, CurUserName))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "作废失败!无权限!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                //HInterID数据判断
                if (HInterID <= 0)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "HInterID小于0!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                Int64 lngBillKey = 0;
                lngBillKey = DBUtility.ClsPub.isLong(HInterID);                                         //对HInterID进行类型的转换
                DAL.ClsQC_NoPassProdConclusionBill oBill = new DAL.ClsQC_NoPassProdConclusionBill();              //实例化单据操作类,用于进行相关操作
                //针对需要进行的操作,检验当前单据的状态是否支持需要进行的操作
                if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo))                    //根据HInterID获取该单据的数据
                {
                    if (oBill.omodel.HChecker.Trim() != "")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "单据已审核!不能进行作废!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (IsAudit == 0)  //作废判断
                    {
                        if (oBill.omodel.HDeleteMan.Trim() != "")
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "单据已作废!不能再作废!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                    }
                    if (IsAudit == 1) //反作废判断
                    {
                        if (oBill.omodel.HDeleteMan.Trim() == "")
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "单据未作废!不需要反作废!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                    }
                }
                else
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "单据不存在!原因:" + DBUtility.ClsPub.sExeReturnInfo;
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                //进行需要进行的作废/反作废操作
                if (IsAudit == 0) //作废提交
                {
                    //作废提交
                    if (oBill.Cancelltion(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo) == true)
                    {
                        objJsonResult.code = "1";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "作废成功";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    else
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "作废失败!原因:" + DBUtility.ClsPub.sExeReturnInfo;
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                }
                if (IsAudit == 1) //反关闭提交
                {
                    //反关闭提交
                    if (oBill.AbandonCancelltion(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo) == true)
                    {
                        objJsonResult.code = "1";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反作废成功";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    else
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "反作废失败!原因:" + DBUtility.ClsPub.sExeReturnInfo;
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                }
                return objJsonResult;
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "作废失败或者反作废失败!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
        #endregion
    }
}
WebAPI/Controllers/WebAPIController.cs
@@ -1281,6 +1281,55 @@
                return objjson;
            }
        }
        /// <summary>
        /// èŽ·å–ç”Ÿäº§èµ„æºåˆ—è¡¨
        /// </summary>
        /// <returns></returns>
        [Route("Web/GetSouceList_Json")]
        [HttpGet]
        public object GetSouceList_Json(string HMaterID,string Value, Int64 HOrgID)
        {
            sWhere = " and HStopFlag=0 and HUSEORGID =" + HOrgID + "";
            if (Value != "" && Value != null)
            {
                sWhere = sWhere + " and ( HNumber like '%" + Value + "%' or HName like '%" + Value + "%' or HUSEORGID like '%" + HOrgID + "%' ) ";
            }
            try
            {
                string sql = "EXEC h_p_Gy_SouceViewList " + HMaterID+",'"+ sWhere + "'";
                ds = oCN.RunProcReturn(sql, "h_p_Gy_SouceViewList");
                if (ds == null || ds.Tables[0].Rows.Count <= 0)
                {
                    objjson.code = "0";
                    objjson.count = 0;
                    objjson.Message = "获取失败" + DBUtility.ClsPub.sErrInfo;
                    objjson.data = null;
                    return objjson;
                }
                else
                {
                    objjson.code = "0";
                    objjson.count = 1;
                    objjson.Message = "获取成功!";
                    objjson.data = ds.Tables[0];
                    return objjson;
                }
            }
            catch (Exception ex)
            {
                objjson.code = "0";
                objjson.count = 0;
                objjson.Message = "获取失败" + ex.ToString();
                objjson.data = null;
                return objjson;
            }
        }
        /// <summary>
        /// èŽ·å–èŒå‘˜åˆ—è¡¨
        /// </summary>
WebAPI/DLL/ClsGy_Material_Ctl.cs
@@ -27,7 +27,7 @@
                    ",HSubjoin,HSubjoin2,HColor,HVersion,HEngName,HEngModel,HPropertyTypeID,HSPGroupID,HSPID,HMinPickQty,HUSEORGID,HERPItemID" +
                    ",HSALEUNITID,HSALEPRICEUNITID,HBASEUNITID,HSTOREUNITID,HCHECKINCOMING,HCHECKPRODUCT,HPERUNITSTANDHOUR" +
                    ",HSTDLABORPREPARETIME,HSTDMACHINEPREPARETIME,HWidth,HWeight,HColorRemark,HQCSchemeID_Fst,HQCSchemeID_Proc,HQCSchemeID_Patrol" +
                    ",HMaterRuleType,HColorNo,HPieceMaxQty) " +
                    ",HMaterRuleType,HColorNo,HPieceMaxQty,HCommonUseFlag,HAvgStockPrice,HFootPrice,HTaxCost,HNoTaxCost) " +
                    " Values('" + oModel.HNumber + "','" + oModel.HName + "','" + oModel.HHelpCode + "','" + oModel.HShortNumber + "'," + oModel.HParentID.ToString() +
                    ", " + oModel.HLevel.ToString() + "," + Convert.ToString(oModel.HEndFlag ? 1 : 0) + "," + Convert.ToString(oModel.HStopflag ? 1 : 0) + ",'" + oModel.HRemark + "'" +
                    ",'" + oModel.HModel + "'," + oModel.HUnitID.ToString() + "," + oModel.HMaterClsID.ToString() + "," + oModel.HMaterTypeID.ToString() + "," + oModel.HUnitGroupID.ToString() +
@@ -36,7 +36,7 @@
                    ", " + oModel.HKeepDays.ToString() + "," + oModel.HPlanPrice.ToString() + "," + oModel.HstdPrice.ToString() + "," + oModel.HQtyMin.ToString() + "," + oModel.HQtyMax.ToString() +
                    ",'" + oModel.HSubjoin + "','" + oModel.HSubjoin2 + "','" + oModel.HColor + "','" + oModel.HVersion + "','" + oModel.HEngName + "','" + oModel.HEngModel + "'," + oModel.HPropertyTypeID.ToString() + "," + oModel.HSPGroupID.ToString() + "," + oModel.HSPID.ToString() + "," + oModel.HMinPickQty.ToString() + "," + oModel.HUSEORGID + "," + oModel.HERPItemID + "," + oModel.HSALEUNITID + "," + oModel.HSALEPRICEUNITID + "," + oModel.HBASEUNITID + "," + oModel.HSTOREUNITID + "," + oModel.HCHECKINCOMING + "," + oModel.HCHECKPRODUCT + "," + oModel.HPERUNITSTANDHOUR + "," + oModel.HSTDLABORPREPARETIME + "," + oModel.HSTDMACHINEPREPARETIME + ","+ oModel.HWidth + "," + oModel.HWeight + ",'"+ oModel.HColorRemark + "'," + oModel.HQCSchemeID_Fst + ","
                       + oModel.HQCSchemeID_Proc + "," + oModel.HQCSchemeID_Patrol + "" +
                       ",'"+ oModel.HMaterRuleType + "','"+ oModel.HColorNo + "','" + oModel.HPieceMaxQty.ToString() + "')", ref DBUtility.ClsPub.sExeReturnInfo);
                       ",'"+ oModel.HMaterRuleType + "','"+ oModel.HColorNo + "','" + oModel.HPieceMaxQty.ToString() + "','" + oModel.HCommonUseFlag.ToString() + "','" + oModel.HAvgStockPrice.ToString() + "','" + oModel.HFootPrice.ToString() + "','" + oModel.HTaxCost.ToString() + "','" + oModel.HNoTaxCost.ToString() + "')", ref DBUtility.ClsPub.sExeReturnInfo);
                //修改上级为非末级代码
                oCn.RunProc("Update " + MvarItemKey + " set HEndflag=0 where HItemID=" + oModel.HParentID, ref DBUtility.ClsPub.sExeReturnInfo);
                oCn.Commit();
@@ -65,14 +65,14 @@
                    ",HWhID,HRoutingID,HBomID,HSecUnitID,HSecUnitRate" +
                    ",HHighStock,HLowStock,HSafeStock,HOrderPrice,HSalePrice" +
                    ",HKeepDays,HPlanPrice,HstdPrice,HQtyMin,HQtyMax" +
                    ",HSubjoin,HSubjoin2,HColor,HVersion,HEngName,HEngModel,HPropertyTypeID,HSPGroupID,HSPID,HMinPickQty,HCREATEORGID,HUSEORGID,HERPItemID,HBatchManager,HOldMaterNumber,HPieceMaxQty) " +
                    ",HSubjoin,HSubjoin2,HColor,HVersion,HEngName,HEngModel,HPropertyTypeID,HSPGroupID,HSPID,HMinPickQty,HCREATEORGID,HUSEORGID,HERPItemID,HBatchManager,HOldMaterNumber,HPieceMaxQty,HCommonUseFlag,HAvgStockPrice,HFootPrice,HTaxCost,HNoTaxCost) " +
                    " Values('" + oModel.HItemID + "','" + oModel.HNumber + "','" + oModel.HName + "','" + oModel.HHelpCode + "','" + oModel.HShortNumber + "'," + oModel.HParentID.ToString() +
                    ", " + oModel.HLevel.ToString() + "," + Convert.ToString(oModel.HEndFlag ? 1 : 0) + "," + Convert.ToString(oModel.HStopflag ? 1 : 0) + ",'" + oModel.HRemark + "'" +
                    ",'" + oModel.HModel + "'," + oModel.HUnitID.ToString() + "," + oModel.HMaterClsID.ToString() + "," + oModel.HMaterTypeID.ToString() + "," + oModel.HUnitGroupID.ToString() +
                    ", " + oModel.HWhID.ToString() + "," + oModel.HRoutingID.ToString() + "," + oModel.HBomID.ToString() + "," + oModel.HSecUnitID.ToString() + "," + oModel.HSecUnitRate.ToString() +
                    ", " + oModel.HHighStock.ToString() + "," + oModel.HLowStock.ToString() + "," + oModel.HSafeStock.ToString() + "," + oModel.HOrderPrice.ToString() + ",'" + oModel.HSalePrice + "'" +
                    ", " + oModel.HKeepDays.ToString() + "," + oModel.HPlanPrice.ToString() + "," + oModel.HstdPrice.ToString() + "," + oModel.HQtyMin.ToString() + "," + oModel.HQtyMax.ToString() +
                    ",'" + oModel.HSubjoin + "','" + oModel.HSubjoin2 + "','" + oModel.HColor + "','" + oModel.HVersion + "','" + oModel.HEngName + "','" + oModel.HEngModel + "'," + oModel.HPropertyTypeID.ToString() + "," + oModel.HSPGroupID.ToString() + "," + oModel.HSPID.ToString() + "," + oModel.HMinPickQty.ToString() + "," + oModel.HCREATEORGID + "," + oModel.HUSEORGID + "," + oModel.HERPItemID + "," + oModel.HBatchManager + ",'" + oModel.HOldMaterNumber + "','" + oModel.HPieceMaxQty.ToString() + "')", ref DBUtility.ClsPub.sExeReturnInfo);
                    ",'" + oModel.HSubjoin + "','" + oModel.HSubjoin2 + "','" + oModel.HColor + "','" + oModel.HVersion + "','" + oModel.HEngName + "','" + oModel.HEngModel + "'," + oModel.HPropertyTypeID.ToString() + "," + oModel.HSPGroupID.ToString() + "," + oModel.HSPID.ToString() + "," + oModel.HMinPickQty.ToString() + "," + oModel.HCREATEORGID + "," + oModel.HUSEORGID + "," + oModel.HERPItemID + "," + oModel.HBatchManager + ",'" + oModel.HOldMaterNumber + "','" + oModel.HPieceMaxQty.ToString() + "','" + oModel.HCommonUseFlag.ToString() + "','" + oModel.HAvgStockPrice.ToString() + "','" + oModel.HFootPrice.ToString() + "','" + oModel.HTaxCost.ToString() + "','" + oModel.HNoTaxCost.ToString() + "')", ref DBUtility.ClsPub.sExeReturnInfo);
                sql = "set identity_insert gy_material off";
                oCn.RunProc(sql);
                //修改上级为非末级代码
@@ -149,6 +149,11 @@
                    ",HQCSchemeID_Proc= " + oModel.HQCSchemeID_Proc +
                    ",HQCSchemeID_Patrol= " + oModel.HQCSchemeID_Patrol +
                    ",HPieceMaxQty=" + oModel.HPieceMaxQty.ToString() +
                    ",HCommonUseFlag=" + oModel.HCommonUseFlag.ToString() +
                    ",HAvgStockPrice=" + oModel.HAvgStockPrice.ToString() +
                    ",HFootPrice=" + oModel.HFootPrice.ToString() +
                    ",HTaxCost=" + oModel.HTaxCost.ToString() +
                    ",HNoTaxCost=" + oModel.HNoTaxCost.ToString() +
                    ",HSTDMACHINEPREPARETIME=" + oModel.HSTDMACHINEPREPARETIME.ToString() + "Where HItemID=" + sItemID, ref DBUtility.ClsPub.sExeReturnInfo);
                //修改子项目代码
                oCn.RunProc("exec h_p_Gy_UpdateNumber '" + MvarItemKey + "','" + oModel.HNumber + ".','" + this.HOldNumber + ".'", ref DBUtility.ClsPub.sExeReturnInfo);
WebAPI/DLL/ClsOA_ErrMsgBackBill.cs
@@ -127,7 +127,7 @@
            try
            {
                //得到mainid
                omodel.HInterID = DBUtility.ClsPub.CreateBillID(BillType, ref DBUtility.ClsPub.sExeReturnInfo);
                //omodel.HInterID = DBUtility.ClsPub.CreateBillID(BillType, ref DBUtility.ClsPub.sExeReturnInfo);
                //若MAINDI重复则重新获取
                oCn.BeginTran();
                //主表
@@ -137,7 +137,7 @@
                ",HContext,HDeptID,HDescription,HSendMan,HReceiveMan" +
                ",HCopyMan,HHasten,HLevel,HReTransmitMan,HBillTypeName"+
                ",HPlanBillNo,HMaterName,HMaterModel,HQty,HSendType"+
                ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRecDeptID,HMaterNumber" +
                ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRecDeptID,HMaterNumber,HErrMsgBackTypeID" +
                ") " +
                " values('" + this.BillType + "','"  + this.HBillSubType + "'," +omodel.HInterID.ToString() + ",'" + omodel.HBillNo + "','" + omodel.HDate + "'" +
                "," + omodel.HYear.ToString() + "," + omodel.HPeriod.ToString() + ",'" + omodel.HRemark + "','" + DBUtility.ClsPub.CurUserName + "',getdate()" +
@@ -145,7 +145,7 @@
                ",'" + omodel.HCopyMan + "'," + omodel.HHasten.ToString() + ",'" + omodel.HLevel + "','" + omodel.HReTransmitMan + "','" + omodel.HBillTypeName + "'" +
                ",'" + omodel.HPlanBillNo + "','" + omodel.HMaterName + "','" + omodel.HMaterModel + "'," + omodel.HQty.ToString() + ",'" + omodel.HSendType + "'" +
                ",'" + omodel.HMainSourceInterID + "','" + omodel.HMainSourceEntryID + "','" + omodel.HMainSourceBillNo + "','" + omodel.HMainSourceBillType + "'" +
                "," + omodel.HRecDeptID + ",'" + omodel.HMaterNumber + "'" +
                "," + omodel.HRecDeptID + ",'" + omodel.HMaterNumber + "'," + omodel.HErrMsgBackTypeID +
                ") ");
                //插入子表
                //foreach (Models.ClsOA_ErrMsgBackBillSub oSub in DetailColl)
WebAPI/ListModels.cs
@@ -431,6 +431,18 @@
        }
        /// <summary>
        /// å¤„理新增不良品评审结论单表的json
        /// </summary>
        /// <param name="jsonString"></param>
        /// <returns></returns>
        public List<Model.ClsQC_NoPassProdConclusionBillMain> getObjectByJson_QC_NoPassProdConclusionBill(string jsonString)
        {
            jsonString = "[" + jsonString.ToString() + "]";
            List<Model.ClsQC_NoPassProdConclusionBillMain> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsQC_NoPassProdConclusionBillMain>>(jsonString);
            return list;
        }
        /// <summary>
        /// å¤„理新增部门基础资料的JSON
        /// </summary>
        /// <param name="jsonString"></param>
WebAPI/Models/ClsGy_Material_Model.cs
@@ -65,5 +65,15 @@
        public string HColorNo;//颜色色号
        public double HPieceMaxQty; //单件最大上限
        public int HCommonUseFlag; // æ˜¯å¦ä¸å¸¸ç”¨ææ–™
        public double HAvgStockPrice; // åŠ æƒå¹³å‡ä»·
        public double HFootPrice; // ç»“ç®—ä»·
        public double HTaxCost; // å«ç¨Žæˆæœ¬ä»·
        public double HNoTaxCost; // ä¸å«ç¨Žæˆæœ¬ä»·
    }
}
WebAPI/Models/ClsKf_ICStockBillMain.cs
@@ -13,6 +13,7 @@
        public Int64 HManagerID;        //          int                --负责人(主管)
        public Int64 HSecManagerID;     //          int               --验收
        public Int64 HKeeperID;         //          int                --保管员
        public Int64 HProjectID;         //          int                --项目
        public Int64 HDeptID;           //            int             --部门
        public Int64 HCurID;            //            int                --币别( ç•Œé¢ä¸Šä¸éœ€è¦æ˜¾ç¤ºï¼Œå­˜0进去)
        public string HExplanation;     //            varchar(200)    --ÕªÒª
@@ -49,6 +50,7 @@
        public string HOWNERTYPEID;     //            varchar(100)    --货主类型
        public Int64 HOrgID; 
        public string HStockStyle;      //            varchar(100)    --库存类型
        public string HInvoiceBillNo;      //            varchar(100)    --发票编号
                                        //源单信息
        public string HSourceBillNo;
        public string HSourceBillType;
WebAPI/Models/ClsKf_ICStockBillSub.cs
@@ -74,6 +74,7 @@
        public Int64 HSourceInterID;
        public Int64 HSourceEntryID;
        public Int64 HAuxPropID;
        public Int64 HlineTotal;
        public object HContainerNum { get; internal set; }
        public object HPVC { get; internal set; }
WebAPI/Models/ClsOA_ErrMsgBackBillMain.cs
@@ -25,5 +25,7 @@
        public string HMaterNumber;//    varchar(100)    ç‰©æ–™ç¼–码      
        public Int64 HRecDeptID;//     int      --接收部门
        public Int64 HErrMsgBackTypeID; //异常类型
    }
}
WebAPI/Models/Gy_User.cs
@@ -34,5 +34,6 @@
        public int HProcID;
        public int HGroupID;
        public int HSourceID;
        public int HCheckEmpID;
    }
}
WebAPI/Web.config
@@ -22,7 +22,7 @@
        <!--<add key="FileIP" value="http://localhost:8082/LuBaoAPI"/>-->
        <!--<add key="FileIP" value="http://localhost:8080/" />-->
        <!--<add key="sUrl" value="http://183.129.128.86:9090/WEBS-WMSTest/WebService1.asmx"/>    -->
        <add key="sUrl" value="http://192.168.63.53/WEBS-WMS/WebService1.asmx"/>   <!--颜台式机-->
        <!--add key="sUrl" value="http://192.168.63.53/WEBS-WMS/WebService1.asmx"/>   é¢œå°å¼æœº-->
        <!--<add key="sUrl" value="http://60.190.4.42:9003/WebService/WebService1.asmx" /> å¤å®-->
        <!--<add key="sUrl" value="http://60.190.4.42:9003/WebService/WebService1.asmx" /> -->
        <!--<add key="sUrl" value="http://10.10.130.181/WEBS-WMS/WebService1.asmx"/>    åšæ—¥ç§‘技-->
@@ -34,7 +34,7 @@
        <!--<add key="sUrl" value="http://192.168.80.90:9090/WEBS-WMS/WebService1.asmx"/>     å®‰ç‘žæœåС噍-->
        <!--<add key="sUrl" value="http://47.96.97.237/WEBS-WMS/WebService1.asmx"/> -->    <!--测试服务器-->
        <!--<add key="sUrl" value="http://localhost:8082/WEBS/WebService1.asmx"/>    æœ¬åœ°-->
        <!--<add key="sUrl" value="http://192.168.110.57:81/WEBS/WebService1.asmx"/>    é™ˆé›¯é™æœ¬åœ°é…ç½®-->
        <add key="sUrl" value="http://192.168.110.57:81/WEBS/WebService1.asmx"/>    <!--陈雯静本地配置-->
        <!--<add key="sUrl" value="http://192.168.1.57:8082/WEBS-WMS/WebService1.asmx"/>九菱-->
        <add key="webpages:Version" value="3.0.0.0" />