yusijie
2023-01-04 378f4b9857f57e483ffed5a77286195c51e62eb5
设备投产
4个文件已添加
3个文件已修改
558 ■■■■■ 已修改文件
DAL/DAL.csproj 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DAL/生产管理/设备管理/ClsSb_EquipWorkBeforeCheckBill.cs 233 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Model/Model.csproj 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Model/生产管理/设备管理/ClsSb_EquipWorkBeforeCheckBillMain.cs 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Model/生产管理/设备管理/ClsSb_EquipWorkBeforeCheckBillSub.cs 19 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Controllers/SBGL/Sb_EquipWorkBeforeCheckBillController.cs 286 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/WebAPI.csproj 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DAL/DAL.csproj
@@ -608,6 +608,7 @@
    <Compile Include="生产管理\设备管理\ClsSb_EquipSparepartsChangeBill.cs" />
    <Compile Include="生产管理\设备管理\ClsSb_EquipStockInCheckBill.cs" />
    <Compile Include="生产管理\设备管理\ClsSb_EquipStatusChangeBill.cs" />
    <Compile Include="生产管理\设备管理\ClsSb_EquipWorkBeforeCheckBill.cs" />
    <Compile Include="质检管理\ClsQC_FirstPieceCheckBill.cs" />
    <Compile Include="质检管理\ClsQC_LastPieceCheckBill.cs" />
    <Compile Include="质检管理\ClsQC_NoPassProdCheckBill.cs" />
DAL/Éú²ú¹ÜÀí/É豸¹ÜÀí/ClsSb_EquipWorkBeforeCheckBill.cs
New file
@@ -0,0 +1,233 @@
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
namespace DAL
{
    public class ClsSb_EquipWorkBeforeCheckBill : DBUtility.ClsXt_BaseBill
    {
        public Model.ClsSb_EquipWorkBeforeCheckBillMain omodel = new Model.ClsSb_EquipWorkBeforeCheckBillMain();
        public List<Model.ClsSb_EquipWorkBeforeCheckBillSub> DetailColl = new List<Model.ClsSb_EquipWorkBeforeCheckBillSub>();
        public ClsSb_EquipWorkBeforeCheckBill()
        {
            base.MvarItemKeySub = "Sb_EquipWorkBeforeCheckBillSub";
            base.MvarItemKeySub2 = "";
            base.MvarItemKeySub3 = "";
            base.MvarItemKeySub4 = "";
            base.MvarItemKey = "Sb_EquipWorkBeforeCheckBillMain";
            base.MvarReportTitle = "设备投产检验验收单";
            base.BillType = "3915";
            base.HBillSubType = "3915";
        }
        //修改单据
        public override bool ModifyBill(Int64 lngBillKey, ref string sReturn)
        {
            try
            {
                //
                oCn.BeginTran();
                //更新主表
                oCn.RunProc("UpDate Sb_EquipWorkBeforeCheckBillMain set  " +
                " HBillNo='" + omodel.HBillNo + "'" +  //固定赋值===============
                ",HDate='" + omodel.HDate + "'" +
                ",HYear='" + omodel.HYear.ToString() + "'" +
                ",HPeriod='" + omodel.HPeriod.ToString() + "'" +
                ",HBillStatus=" + omodel.HBillStatus.ToString() +
                ",HRemark='" + omodel.HRemark + "'" +
                ",HUpDater='" + DBUtility.ClsPub.CurUserName + "'" +
                ",HUpDateDate=getdate()" +
                //========================================
                ",HSupID=" + omodel.HSupID.ToString() +
                ",HEquipID=" + omodel.HEquipID.ToString() +
                ",HFirstCheckEmp=" + omodel.HFirstCheckEmp.ToString() +
                ",HCheckerResult ='" + omodel.HCheckerResult.ToString() + "'" +
                " where HInterID=" + lngBillKey.ToString());
                //删除关联
                DeleteRelation(ref sReturn, lngBillKey);
                //删除子表
                DeleteBillSub(lngBillKey);
                //插入子表
                omodel.HInterID = lngBillKey;
                foreach (Model.ClsSb_EquipWorkBeforeCheckBillSub oSub in DetailColl)
                {
                    oCn.RunProc("Insert into Sb_EquipWorkBeforeCheckBillSub " +
                      " (HInterID,HEntryID,HCloseMan,HCloseType,HRemark,HBillNo_bak" +
                      ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" +
                     ",HItemSubID,HQCCheckClassID,HQCCheckItemID,HQCStd,HQCRelValue,HResult,HProcCheckEmp,HProcCheckTime" +
                      ") values("
                      + omodel.HInterID.ToString() + "," + oSub.HEntryID.ToString() + ",'" + oSub.HCloseMan + "','" + oSub.HEntryCloseDate.ToShortDateString() + "'," + Convert.ToString(oSub.HCloseType ? 1 : 0) + ",'" + oSub.HRemark + "','" + omodel.HBillNo + "'" +
                      "," + oSub.HSourceInterID.ToString() + "," + oSub.HSourceEntryID.ToString() + ",'" + oSub.HSourceBillNo + "','" + oSub.HSourceBillType + "'," + oSub.HRelationQty.ToString() + "," + oSub.HRelationMoney.ToString() +
                      "," + 0 + "," + oSub.HQCCheckClassID + "," + oSub.HQCCheckItemID + ",'" + oSub.HQCStd + "','" + oSub.HQCRelValue + "','" + oSub.HResult + "'," + oSub.HProcCheckEmp +
                      ",'" + oSub.HProcCheckTime + "'" + ") ");
                }
                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);
                omodel.HBillNo = DBUtility.ClsPub.CreateBillCode(BillType, ref DBUtility.ClsPub.sExeReturnInfo, true);
                //若MAINDI重复则重新获取
                if (IsExistBillNo(ref DBUtility.ClsPub.sExeReturnInfo, omodel.HBillNo, Pub_Class.ClsPub.Enum_BillStatus.BillStatus_AddNew, omodel.HInterID))
                {
                    omodel.HBillNo = DBUtility.ClsPub.CreateBillCode(BillType, ref DBUtility.ClsPub.sExeReturnInfo, true);
                }
                if (IsExistMainID(ref DBUtility.ClsPub.sExeReturnInfo, omodel.HInterID, Pub_Class.ClsPub.Enum_BillStatus.BillStatus_AddNew))
                {
                    omodel.HInterID = DBUtility.ClsPub.CreateBillID(BillType, ref DBUtility.ClsPub.sExeReturnInfo);
                }
                //
                oCn.BeginTran();
                //HInterID,HYear,HPeriod,HBillType,HBillSubType,HDate,HBillNo,HBillStatus
                //     ,HRemark,HBackRemark,HMaker,HMakeDate,HMainSourceBillType,HMainSourceInterID
                //     ,HMainSourceEntryID,HMainSourceBillNo,HPrintQty,HSupID,HEquipID,HFirstCheckEmp,HCheckerResult
                //主表
                oCn.RunProc("Insert Into Sb_EquipWorkBeforeCheckBillMain   " +
                "(HBillType,HBillSubType,HInterID,HBillNo,HDate" +
                ",HYear,HPeriod,HRemark,HMaker,HMakeDate,HSupID,HFirstCheckEmp" +
                ",HBillStatus,HBackRemark,HMaker,HMakeDate,HMainSourceBillType" +
                ",HMainSourceInterID,HMainSourceEntryID,HMainSourceBillNo,HPrintQty" +
                ",HCheckItemNowID,HCheckItemNextID,HCheckFlowID,HBacker,HChecker,HUpDater,HCloseMan,HCloseType,HDeleteMan,HEquipID,HCheckerResult" +
                ") " +
                " 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.HFirstCheckEmp.ToString() + "," + 1 + ",'" + omodel.HBackRemark +
                "','" + omodel.HMaker + "','" + omodel.HMakeDate + "','" + omodel.HMainSourceBillType + "'," + omodel.HMainSourceInterID +
                "," + omodel.HMainSourceEntryID + ",'" + omodel.HMainSourceBillNo + "'," + omodel.HPrintQty + ",0,0,0" + ",'" + omodel.HBacker +
                "','" + omodel.HChecker + "','" + omodel.HUpDater + "','" + omodel.HCloseMan + "'," + 0 + ",'" + omodel.HDeleteMan +
                "'," + omodel.HEquipID + ",'" + omodel.HCheckerResult + "'" + ") ");
                //插入子表
                foreach (Model.ClsSb_EquipWorkBeforeCheckBillSub oSub in DetailColl)
                {
                    oCn.RunProc("Insert into Sb_EquipWorkBeforeCheckBillSub " +
                      " (HInterID,HEntryID,HCloseMan,HCloseType,HRemark,HBillNo_bak" +
                      ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" +
                     ",HItemSubID,HQCCheckClassID,HQCCheckItemID,HQCStd,HQCRelValue,HResult,HProcCheckEmp,HProcCheckTime" +
                      ") values("
                      + omodel.HInterID.ToString() + "," + oSub.HEntryID.ToString() + ",'" + oSub.HCloseMan + "','" + oSub.HEntryCloseDate.ToShortDateString() + "'," + Convert.ToString(oSub.HCloseType ? 1 : 0) + ",'" + oSub.HRemark + "','" + omodel.HBillNo + "'" +
                      "," + oSub.HSourceInterID.ToString() + "," + oSub.HSourceEntryID.ToString() + ",'" + oSub.HSourceBillNo + "','" + oSub.HSourceBillType + "'," + oSub.HRelationQty.ToString() + "," + oSub.HRelationMoney.ToString() +
                      "," + 0 + "," + oSub.HQCCheckClassID + "," + oSub.HQCCheckItemID + ",'" + oSub.HQCStd + "','" + oSub.HQCRelValue + "','" + oSub.HResult + "'," + oSub.HProcCheckEmp +
                      ",'" + oSub.HProcCheckTime + "'" + ") ");
                }
                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 Sb_EquipWorkBeforeCheckBillMain Where HInterID=" + lngBillKey.ToString(), "Sb_EquipWorkBeforeCheckBillMain");
                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 = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBillNo"]);
                omodel.HBillStatus = 1;
                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 = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HRemark"]);
                omodel.HBackDate = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBackDate"]);
                omodel.HBacker = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBacker"]);
                omodel.HCheckDate = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HCheckDate"]);
                omodel.HChecker = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HChecker"]);
                omodel.HMaker = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HMaker"]);
                omodel.HMakeDate = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HMakeDate"]);
                omodel.HUpDateDate = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HUpDateDate"]);
                omodel.HUpDater = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HUpDater"]);
                omodel.HCloseDate = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HCloseDate"]);
                omodel.HCloseMan = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HCloseMan"]);
                omodel.HCloseType = DBUtility.ClsPub.isBool(Ds.Tables[0].Rows[0]["HCloseType"]);
                omodel.HDeleteDate = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HDeleteDate"]);
                omodel.HDeleteMan = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HDeleteMan"]);
                omodel.HMainSourceBillType = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HMainSourceBillType"]);
                omodel.HMainSourceInterID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HMainSourceInterID"]);
                omodel.HMainSourceEntryID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HMainSourceEntryID"]);
                omodel.HMainSourceBillNo = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HMainSourceBillNo"]);
                omodel.HPrintQty = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HPrintQty"]);
                //========================================================
                omodel.HSupID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HSupID"]);
                omodel.HFirstCheckEmp = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HFirstCheckEmp"]);
                omodel.HEquipID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HEquipID"]);
                omodel.HCheckerResult = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HCheckerResult"]);
                //循环
                DataSet DsSub;
                DsSub = oCn.RunProcReturn("Select * from Sb_EquipWorkBeforeCheckBillSub Where HInterID=" + lngBillKey.ToString(), "Sb_EquipWorkBeforeCheckBillSub");
                DetailColl.Clear();//清空
                for (int i = 0; i < DsSub.Tables[0].Rows.Count; i++)
                {
                    Model.ClsSb_EquipWorkBeforeCheckBillSub oSub = new Model.ClsSb_EquipWorkBeforeCheckBillSub();
                    // å›ºå®šèµ‹å€¼===============================================
                    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 = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HSourceBillType"]);
                    oSub.HSourceBillNo = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HSourceBillNo"]);
                    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 = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HRemark"]);
                    oSub.HBillNo_bak = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HBillNo_bak"]);
                    //===================================================
                    oSub.HQCCheckClassID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HQCCheckClassID"]);
                    oSub.HQCCheckItemID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HQCCheckItemID"]);
                    oSub.HQCStd = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HQCStd"]);
                    oSub.HQCRelValue = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HQCRelValue"]);
                    oSub.HResult = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HResult"]);
                    oSub.HProcCheckEmp = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HProcCheckEmp"]);
                    oSub.HProcCheckTime = DBUtility.ClsPub.isDate(DsSub.Tables[0].Rows[i]["HProcCheckTime"]);
                    DetailColl.Add(oSub);
                }
                sReturn = "显示单据成功!";
                return true;
            }
            catch (Exception e)
            {
                sReturn = e.Message;
                throw (e);
            }
        }
    }
}
Model/Model.csproj
@@ -606,6 +606,8 @@
    <Compile Include="生产管理\设备管理\ClsSb_EquipStatusChangeBillSub.cs" />
    <Compile Include="生产管理\设备管理\ClsSb_EquipStockInCheckBillMain.cs" />
    <Compile Include="生产管理\设备管理\ClsSb_EquipStockInCheckBillSub.cs" />
    <Compile Include="生产管理\设备管理\ClsSb_EquipWorkBeforeCheckBillMain.cs" />
    <Compile Include="生产管理\设备管理\ClsSb_EquipWorkBeforeCheckBillSub.cs" />
    <Compile Include="生产管理\设备管理\ClsSc_EquipMaintainBillSub_Item.cs" />
    <Compile Include="生产管理\设备管理\ClsSc_EquipMaintainPlanBillSub_Item.cs" />
    <Compile Include="生产管理\设备管理\ClsSc_ICMOBillMain.cs" />
Model/Éú²ú¹ÜÀí/É豸¹ÜÀí/ClsSb_EquipWorkBeforeCheckBillMain.cs
New file
@@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Model
{
    public class ClsSb_EquipWorkBeforeCheckBillMain : DBUtility.ClsXt_BaseBillMain
    {
        public Int64 HPrintQty; //打印次数
        public Int64 HSupID;            //检测商
        public Int64 HEquipID;            //设备
        public Int64 HFirstCheckEmp;            //检验员
        public string HCheckerResult;          //判定结论
    }
}
Model/Éú²ú¹ÜÀí/É豸¹ÜÀí/ClsSb_EquipWorkBeforeCheckBillSub.cs
New file
@@ -0,0 +1,19 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Model
{
    public class ClsSb_EquipWorkBeforeCheckBillSub : DBUtility.ClsXt_BaseBillSub
    {
        public string HBillNo_bak;        //单据号(备份,以免内码丢失,找不到对应主表)
        public Int64 HItemSubID; //自增列(GUID)
        public Int64 HQCCheckClassID;
        public Int64 HQCCheckItemID;
        public string HQCStd;
        public string HQCRelValue;
        public string HResult;
        public Int64 HProcCheckEmp;
        public DateTime HProcCheckTime;
    }
}
WebAPI/Controllers/SBGL/Sb_EquipWorkBeforeCheckBillController.cs
New file
@@ -0,0 +1,286 @@
using DBUtility;
using Model;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
using WebAPI.Models;
namespace WebAPI.Controllers.SBGL
{
    public class Sb_EquipWorkBeforeCheckBillController : ApiController
    {
        private json objJsonResult = new json();
        SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
        DataSet ds;
        #region [设备投产检验验收单列表]
        [Route("Sb_EquipWorkBeforeCheckBill/list")]
        [HttpGet]
        public object list(string sWhere, string user)
        {
            try
            {
                if (sWhere == null || sWhere.Equals(""))
                {
                    ds = oCN.RunProcReturn("select * from h_v_Sb_EquipWorkBeforeCheckBillList order by hmainid asc", "h_v_Sb_EquipWorkBeforeCheckBillList");
                }
                else
                {
                    string sql1 = "select * from h_v_Sb_EquipWorkBeforeCheckBillList where 1 = 1 ";
                    string sql = sql1 + sWhere + " order by hmainid asc";
                    ds = oCN.RunProcReturn(sql, "h_v_Sb_EquipWorkBeforeCheckBillList");
                }
                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
        #region [根据ID查找记录]
        [Route("Sb_EquipWorkBeforeCheckBill/cx")]
        [HttpGet]
        public object cx(long HInterID)
        {
            try
            {
                ds = oCN.RunProcReturn("select * from h_v_Sb_EquipWorkBeforeCheckBillList where hmainid =" + HInterID, "h_v_Sb_EquipWorkBeforeCheckBillList");
                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
        #region è®¾å¤‡æŠ•产检验验收单 ä¿å­˜/编辑功能
        [Route("Sb_EquipWorkBeforeCheckBill/EquipWorkBeforeCheckBillEdit")]
        [HttpPost]
        public object EquipWorkBeforeCheckBillEdit([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;
            }
        }
        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();
            try
            {
                msg2 = "[" + msg2.ToString() + "]";
                List<ClsSb_EquipWorkBeforeCheckBillMain> mainList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<ClsSb_EquipWorkBeforeCheckBillMain>>(msg2);
                long HInterID = mainList[0].HInterID;//递入type得到的单据ID
                string HBillNo = mainList[0].HBillNo;//递入type得到的单据号
                long HBillStatus = 1;//单据状态
                DateTime HDate = mainList[0].HDate;//日期
                string HRemark = mainList[0].HRemark;//备注
                long HSupID = mainList[0].HSupID;//检测商
                long HEquipID = mainList[0].HEquipID;//设备
                long HFirstCheckEmp = mainList[0].HFirstCheckEmp;//检验员
                string HCheckerResult = mainList[0].HCheckerResult;//摘要
                string HMaker = user;//制单人
                DateTime dt = DateTime.Now;
                //ds = oCN.RunProcReturn("select * from h_v_IF_POOrderBillList where hmainid=" + HInterID + " and å•据号='" + HBillNo + "'", "h_v_IF_POOrderBillList");
                if ((OperationType == 1 || OperationType == 2))//新增   && ds.Tables[0].Rows.Count == 0
                {
                    //DataSet Ds;
                    //Int64 NewHInterID = 1;
                    //Ds = oCN.RunProcReturn("select MAX(HInterID)HInterID from Cg_POOrderBillMain", "Cg_POOrderBillMain");
                    //if (Ds.Tables[0].Rows.Count != 0 && ClsPub.isLong(Ds.Tables[0].Rows[0]["HInterID"].ToString()) != 0)
                    //{
                    //    NewHInterID = ClsPub.isLong(Ds.Tables[0].Rows[0]["HInterID"].ToString());
                    //    NewHInterID += 1;
                    //}
                    //主表
                    oCN.RunProc(@"Insert Into Sb_EquipWorkBeforeCheckBillMain
                        (HInterID,HYear,HPeriod,HBillType,HBillSubType,HDate,HBillNo,HBillStatus
                        ,HRemark,HBackRemark,HMaker,HMakeDate,HMainSourceBillType,HMainSourceInterID
                        ,HMainSourceEntryID,HMainSourceBillNo,HPrintQty,HSupID,HEquipID,HFirstCheckEmp,HCheckerResult)
                        values(" + HInterID + "," + DateTime.Now.Year + "," + DateTime.Now.Month + ",'" + 3915 + "','" +
                    mainList[0].HBillSubType + "','" + HDate + "','" + HBillNo + "','" + HBillStatus + "','" + mainList[0].HRemark +
                    "','" + mainList[0].HBackRemark + "','" + mainList[0].HMaker + "','" + dt + "','" + mainList[0].HMainSourceBillType + "'," + mainList[0].HMainSourceInterID +
                    "," + mainList[0].HMainSourceEntryID + ",'" + mainList[0].HMainSourceBillNo + "'," + mainList[0].HPrintQty + "," + mainList[0].HSupID + ",'" + HEquipID + "'," + HFirstCheckEmp + ",'" + mainList[0].HCheckerResult + "'" + ")");
                }
                else if (OperationType == 3)//|| ds.Tables[0].Rows.Count != 0
                { //修改
                    oCN.RunProc("update Sb_EquipWorkBeforeCheckBillMain  set " +
                                "HRemark='" + HRemark + "', HChecker='" + HMaker + "', HCheckDate=getdate()" + ",HCheckerResult='" + HCheckerResult +
                                "',HSupID=" + HSupID + ",HEquipID=" + HEquipID + ",HFirstCheckEmp=" + HFirstCheckEmp + " where HInterID=" + HInterID);
                    //删除子表
                    oCN.RunProc("delete from Sb_EquipWorkBeforeCheckBillSub where HInterID='" + HInterID + "'");
                }
                //保存子表
                objJsonResult = AddBillSub(msg3, HInterID, OperationType, HBillNo);
                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;
            }
        }
        public json AddBillSub(string msg3, long HInterID, int OperationType, string HBillNo)
        {
            List<ClsSb_EquipWorkBeforeCheckBillSub> DetailColl = Newtonsoft.Json.JsonConvert.DeserializeObject<List<ClsSb_EquipWorkBeforeCheckBillSub>>(msg3);
            int i = 0;
            foreach (ClsSb_EquipWorkBeforeCheckBillSub oSub in DetailColl)
            {
                i++;
                DataSet Cs;
                Int64 NewHEntryID = 1;
                Cs = oCN.RunProcReturn("select MAX(HEntryID)HEntryID from Sb_EquipWorkBeforeCheckBillSub", "Sb_EquipWorkBeforeCheckBillSub");
                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 Sb_EquipWorkBeforeCheckBillSub
                (HInterID,HEntryID,HBillNo_bak,HRemark,HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty
                ,HRelationMoney,HQCCheckClassID,HQCCheckItemID,HQCStd,HQCRelValue,HResult,HProcCheckEmp,HProcCheckTime)
                 values({HInterID},{NewHEntryID},'{ HBillNo }','{oSub.HRemark}',{oSub.HSourceInterID}
                ,{oSub.HSourceEntryID},'{oSub.HSourceBillNo}','{oSub.HSourceBillType}',{oSub.HRelationQty},{oSub.HRelationMoney},{oSub.HQCCheckClassID},{oSub.HQCCheckItemID},'{oSub.HQCStd}','{oSub.HQCRelValue}','{oSub.HResult}',{oSub.HProcCheckEmp},'{oSub.HProcCheckTime}')");
            }
            objJsonResult.code = "1";
            objJsonResult.count = 1;
            objJsonResult.Message = null;
            objJsonResult.data = null;
            return objJsonResult;
        }
        #endregion
        #region [删除]
        [Route("Sb_EquipWorkBeforeCheckBill/Delete")]
        [HttpGet]
        public object Delete(string HInterID, string user)
        {
            try
            {
                oCN.BeginTran();
                oCN.RunProc("Delete From Sb_EquipWorkBeforeCheckBillMain where HInterID = " + HInterID);
                oCN.RunProc("Delete From Sb_EquipWorkBeforeCheckBillSub where HInterID = " + HInterID);
                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
    }
}
WebAPI/WebAPI.csproj
@@ -401,6 +401,7 @@
    <Compile Include="Controllers\SBGL\Sb_EquipSparepartsChangeBillController.cs" />
    <Compile Include="Controllers\SBGL\Sb_EquipStatusChangeBillController.cs" />
    <Compile Include="Controllers\SBGL\Sb_EquipStockInCheckBillController.cs" />
    <Compile Include="Controllers\SBGL\Sb_EquipWorkBeforeCheckBillController.cs" />
    <Compile Include="Controllers\SCGL\Sc_ComplementGoodBill_ZXBZController.cs" />
    <Compile Include="Controllers\SCGL\日计划管理\DataHelper.cs" />
    <Compile Include="Controllers\SCGL\日计划管理\JIT_Cg_PODemandPlanBillController.cs" />
@@ -954,6 +955,7 @@
    <Folder Include="Views\Sb_EquipSparepartsChangeBill\" />
    <Folder Include="Views\Sb_EquipStatusChangeBill\" />
    <Folder Include="Views\Sb_EquipStockInCheckBill\" />
    <Folder Include="Views\Sb_EquipWorkBeforeCheckBill\" />
    <Folder Include="Views\Sc_CallGoodsBackRequestBill\" />
    <Folder Include="Views\Sc_ComplementGoodBill\" />
    <Folder Include="Views\Sc_ComplementGoodBill_ZXBZ\" />