yusijie
2023-03-24 1505f2bf41f2e4c4a92fe087bbf1537432c70cfd
工序派工;工序进出站
8个文件已修改
4个文件已添加
1237 ■■■■ 已修改文件
DAL/DAL.csproj 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DAL/车间管理/ClsSc_ProcExchSendWorkBill.cs 232 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Model/Model.csproj 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Model/车间管理/ClsSc_ProcExchSendWorkBillMain.cs 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Model/车间管理/ClsSc_ProcExchSendWorkBillSub.cs 29 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Controllers/CGGL/Cg_POInStockBillController.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Controllers/CJGL/Cj_StationEntrustInBillController.cs 17 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Controllers/CJGL/Cj_StationOutBillController.cs 177 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Controllers/CJGL/Sc_ProcExchSendWorkBillController.cs 270 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Controllers/CJGL/Sc_ProcessSendWorkController.cs 472 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/ListModels.cs 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/WebAPI.csproj 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DAL/DAL.csproj
@@ -623,6 +623,7 @@
    <Compile Include="质检管理\ClsQC_ProcessCheckBill.cs" />
    <Compile Include="质检管理\ClsQC_ProdReportCheckBill.cs" />
    <Compile Include="车间管理\ClsSc_ProcExchRecordBackBill.cs" />
    <Compile Include="车间管理\ClsSc_ProcExchSendWorkBill.cs" />
    <Compile Include="车间管理\ClsSc_ProcExchWorkBackBill.cs" />
    <Compile Include="车间管理\ClsSc_CutMaterProcExchBill.cs" />
    <Compile Include="车间管理\ClsSc_MaterBackBill.cs" />
DAL/³µ¼ä¹ÜÀí/ClsSc_ProcExchSendWorkBill.cs
New file
@@ -0,0 +1,232 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
namespace DAL
{
    public class ClsSc_ProcExchSendWorkBill : DBUtility.ClsXt_BaseBill
    {
        public Model.ClsSc_ProcExchSendWorkBillMain omodel = new Model.ClsSc_ProcExchSendWorkBillMain();
        public List<Model.ClsSc_ProcExchSendWorkBillSub> DetailColl = new List<Model.ClsSc_ProcExchSendWorkBillSub>();
        public ClsSc_ProcExchSendWorkBill()
        {
            base.MvarItemKeySub = "Sc_ProcExchSendWorkBillSub";
            base.MvarItemKeySub2 = "";
            base.MvarItemKeySub3 = "";
            base.MvarItemKeySub4 = "";
            base.MvarItemKey = "Sc_ProcExchSendWorkBillMain";
            base.MvarReportTitle = "工序流转卡派工单";
            base.BillType = "3798";
            base.HBillSubType = "3798";
        }
        #region å›ºå®šä»£ç 
        ~ClsSc_ProcExchSendWorkBill()
        {
            DetailColl = null;
        }
        #endregion   è‡ªå®šä¹‰æ–¹æ³•
        //修改单据
        public override bool ModifyBill(Int64 lngBillKey, ref string sReturn)
        {
            try
            {
                oCn.BeginTran();
                //更新主表
                oCn.RunProc("UpDate Sc_ProcExchSendWorkBillMain set  " +
                " HBillNo='" + omodel.HBillNo + "'" +  //固定赋值===============
                ",HDate='" + omodel.HDate + "'" +
                ",HYear='" + omodel.HYear.ToString() + "'" +
                ",HPeriod='" + omodel.HPeriod.ToString() + "'" +
                ",HRemark='" + omodel.HRemark + "'" +
                ",HUpDater='" + DBUtility.ClsPub.CurUserName + "'" +
                ",HUpDateDate=getdate()" +
                //========================================
                ",HExplanation='" + omodel.HExplanation + "'" +
                ",HWorkShopID='" + omodel.HWorkShopID + "'" +
                ",HPRDORGID='" + omodel.HPRDORGID + "'" +
                " where HInterID=" + lngBillKey.ToString());
                //删除关联
                DeleteRelation(ref sReturn, lngBillKey);
                //删除子表
                DeleteBillSub(lngBillKey);
                //插入子表
                omodel.HInterID = lngBillKey;
                DataSet Ds;
                foreach (Model.ClsSc_ProcExchSendWorkBillSub oSub in DetailColl)
                {
                    oCn.RunProc("Insert into Sc_ProcExchSendWorkBillSub " +
                     " (HInterID,HEntryID,HBillNo_bak," +
                     "HCloseMan,HEntryCloseDate,HCloseType,HRemark," +
                     "HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney," +
                     "HProcNo,HMaterID,HUnitID,HPlanQty,HQty" +
                     ",HSourceID,HWorkerID,HWorkerNumber,HGroupID,HGroupNumber,HBatchNo,HPlanBeginDate" +
                     ",HPlanEndDate,HWWOrderInterID,HWWOrderEntryID,HWWOrderBillNo,HICMOInterID,HICMOBillNo" +
                     ",HICMOEntryID" +
                     ") values(" +
                     omodel.HInterID + "," + oSub.HEntryID + ",'" + omodel.HBillNo + "'" +
                     ",'" + oSub.HCloseMan + "','" + oSub.HEntryCloseDate + "'," + 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.HProcNo.ToString() + "," + oSub.HMaterID + "," + oSub.HUnitID + ",'" + oSub.HPlanQty + "'," + oSub.HQty + "," + oSub.HSourceID +
                     "," + oSub.HWorkerID + ",'" + oSub.HWorkerNumber + "'," + oSub.HGroupID + ",'" + oSub.HGroupNumber + "','" + oSub.HBatchNo + "','" + oSub.HPlanBeginDate + "','" + oSub.HPlanEndDate +
                     "'," + oSub.HWWOrderInterID + "," + oSub.HWWOrderEntryID + ",'" + oSub.HWWOrderBillNo + "'," + oSub.HICMOInterID + ",'" + oSub.HICMOBillNo + "'," + oSub.HICMOEntryID + ") ");
                }
                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 Sc_ProcExchSendWorkBillMain   " +
                "(HYear,HPeriod,HBillType,HBillSubType,HInterID,HDate,HBillNo,HBillStatus,HMaker,HMakeDate" +
                ",HRemark,HBackRemark,HMainSourceBillType,HMainSourceInterID,HMainSourceEntryID,HMainSourceBillNo" +
                ",HPrintQty,HWorkShopID,HExplanation,HInnerBillNo,HPRDORGID" +
                ") " +
                " values(" + DateTime.Now.Year + "," + DateTime.Now.Month + ",'" + this.BillType + "','" + omodel.HBillSubType + "'," + omodel.HInterID.ToString() + ",'" + omodel.HDate + "','" + omodel.HBillNo + "'," + omodel.HBillStatus + ",'" + omodel.HMaker + "'," + "getdate()" +
                ",'" + omodel.HRemark + "','" + omodel.HBackRemark + "','" + omodel.HMainSourceBillType + "'," + omodel.HMainSourceInterID +
                "," + omodel.HMainSourceEntryID + ",'" + omodel.HMainSourceBillNo + "'," + omodel.HPrintQty + "," + omodel.HWorkShopID + ",'" + omodel.HExplanation +
                "','" + omodel.HInnerBillNo + "'," + omodel.HPRDORGID + ") ");
                //插入子表
                DataSet Ds;
                foreach (Model.ClsSc_ProcExchSendWorkBillSub oSub in DetailColl)
                {
                    oCn.RunProc("Insert into Sc_ProcExchSendWorkBillSub " +
                      " (HInterID,HEntryID,HBillNo_bak," +
                      "HCloseMan,HEntryCloseDate,HCloseType,HRemark," +
                      "HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney," +
                      "HProcNo,HMaterID,HUnitID,HPlanQty,HQty" +
                      ",HSourceID,HWorkerID,HWorkerNumber,HGroupID,HGroupNumber,HBatchNo,HPlanBeginDate" +
                      ",HPlanEndDate,HWWOrderInterID,HWWOrderEntryID,HWWOrderBillNo,HICMOInterID,HICMOBillNo" +
                      ",HICMOEntryID" +
                      ") values("+
                      omodel.HInterID + "," + oSub.HEntryID + ",'" + omodel.HBillNo + "'" +
                      ",'" + oSub.HCloseMan + "','" + oSub.HEntryCloseDate + "'," + 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.HProcNo.ToString() + "," + oSub.HMaterID + "," + oSub.HUnitID + ",'" + oSub.HPlanQty + "'," + oSub.HQty + "," + oSub.HSourceID +
                      "," + oSub.HWorkerID + ",'" + oSub.HWorkerNumber + "'," + oSub.HGroupID + ",'" + oSub.HGroupNumber + "','" + oSub.HBatchNo + "','" + oSub.HPlanBeginDate + "','" + oSub.HPlanEndDate +
                      "'," + oSub.HWWOrderInterID + "," + oSub.HWWOrderEntryID + ",'" + oSub.HWWOrderBillNo + "'," + oSub.HICMOInterID + ",'" + oSub.HICMOBillNo + "'," + oSub.HICMOEntryID + ") ");
                }
                //
                //
                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 Sc_ProcExchSendWorkBillMain Where HInterID=" + lngBillKey.ToString(), "Sc_ProcExchSendWorkBillMain");
                if (Ds.Tables[0].Rows.Count == 0)
                {
                    sReturn = "单据未找到!";
                    return false;
                }
                //固定赋值===========================================
                omodel.HInterID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HInterID"]);
                omodel.HBillNo = Ds.Tables[0].Rows[0]["HBillNo"].ToString().Trim();
                omodel.HDate = DBUtility.ClsPub.isDate(Ds.Tables[0].Rows[0]["HDate"]);
                omodel.HYear = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HYear"]);
                omodel.HPeriod = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HPeriod"]);
                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.HBillStatus = DBUtility.ClsPub.isInt(Ds.Tables[0].Rows[0]["HBillStatus"]);
                omodel.HBillType = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBillType"]);
                omodel.HBillSubType = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBillSubType"]);
                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.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.HCloseDate = Ds.Tables[0].Rows[0]["HCloseDate"].ToString().Trim();
                omodel.HCloseMan = Ds.Tables[0].Rows[0]["HCloseMan"].ToString().Trim();
                omodel.HDeleteDate = Ds.Tables[0].Rows[0]["HDeleteDate"].ToString().Trim();
                omodel.HDeleteMan = Ds.Tables[0].Rows[0]["HDeleteMan"].ToString().Trim();
                //========================================================
                //==
                omodel.HExplanation = Ds.Tables[0].Rows[0]["HExplanation"].ToString().Trim();
                omodel.HInnerBillNo = Ds.Tables[0].Rows[0]["HInnerBillNo"].ToString().Trim();
                //
                omodel.HMainSourceInterID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HMainSourceInterID"]);
                omodel.HMainSourceEntryID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HMainSourceEntryID"]);
                omodel.HMainSourceBillNo = Ds.Tables[0].Rows[0]["HMainSourceBillNo"].ToString().Trim();
                //循环
                DataSet DsSub;
                DsSub = oCn.RunProcReturn("Select * from Sc_ProcExchSendWorkBillSub Where HInterID=" + lngBillKey.ToString() + " order by HEntryID ", "Sc_ProcExchSendWorkBillSub");
                DetailColl.Clear();//清空
                for (int i = 0; i < DsSub.Tables[0].Rows.Count; i++)
                {
                    Model.ClsSc_ProcExchSendWorkBillSub oSub = new Model.ClsSc_ProcExchSendWorkBillSub();
                    // å›ºå®šèµ‹å€¼===============================================
                    oSub.HInterID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HInterID"]);
                    oSub.HBillNo_bak = DsSub.Tables[0].Rows[i]["HBillNo_bak"].ToString().Trim();
                    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.HICMOInterID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HICMOInterID"]);
                    oSub.HICMOBillNo = DsSub.Tables[0].Rows[i]["HICMOBillNo"].ToString().Trim();
                    oSub.HWWOrderInterID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HWWOrderInterID"]);
                    oSub.HWWOrderEntryID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HWWOrderEntryID"]);
                    oSub.HWWOrderBillNo = DsSub.Tables[0].Rows[i]["HWWOrderBillNo"].ToString().Trim();
                    DetailColl.Add(oSub);
                }
                sReturn = "显示单据成功!";
                return true;
            }
            catch (Exception e)
            {
                sReturn = e.Message;
                throw (e);
            }
        }
    }
}
Model/Model.csproj
@@ -582,6 +582,8 @@
    <Compile Include="生产管理\设备管理\ClsSb_EquipConkBookBillSub.cs" />
    <Compile Include="车间管理\ClsSc_ProcExchRecordBackBillMain.cs" />
    <Compile Include="车间管理\ClsSc_ProcExchRecordBackBillSub.cs" />
    <Compile Include="车间管理\ClsSc_ProcExchSendWorkBillMain.cs" />
    <Compile Include="车间管理\ClsSc_ProcExchSendWorkBillSub.cs" />
    <Compile Include="车间管理\ClsSc_ProcExchWorkBackBillSub.cs" />
    <Compile Include="车间管理\ClsSc_ProcExchWorkBackBillMain.cs" />
    <Compile Include="生产管理\设备管理\ClsSb_EquipWorkBeforeCheckBillMain.cs" />
Model/³µ¼ä¹ÜÀí/ClsSc_ProcExchSendWorkBillMain.cs
New file
@@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Model
{
    public class ClsSc_ProcExchSendWorkBillMain : DBUtility.ClsXt_BaseBillMain
    {
        public Int64 HWorkShopID; //生产车间
        public string HExplanation; //摘要
        public string HInnerBillNo; //内部单据号
        public Int64 HPrintQty;
    }
}
Model/³µ¼ä¹ÜÀí/ClsSc_ProcExchSendWorkBillSub.cs
New file
@@ -0,0 +1,29 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Model
{
    public class ClsSc_ProcExchSendWorkBillSub : DBUtility.ClsXt_BaseBillSub
    {
        public string HBillNo_bak; //单据号(备份,以免内码丢失,找不到对应主表)
        public Int64 HProcNo;
        public Int64 HMaterID;
        public Int64 HUnitID;
        public decimal HPlanQty;
        public decimal HQty;
        public Int64 HSourceID;
        public Int64 HWorkerID;
        public string HWorkerNumber;
        public Int64 HGroupID;
        public string HGroupNumber;
        public string HBatchNo;
        public DateTime HPlanBeginDate;
        public DateTime HPlanEndDate;
        public Int64 HWWOrderInterID;
        public Int64 HWWOrderEntryID;
        public string HWWOrderBillNo;
        public Int64 HICMOInterID;
        public string HICMOBillNo;
        public Int64 HICMOEntryID;
    }
}
WebAPI/Controllers/CGGL/Cg_POInStockBillController.cs
@@ -579,7 +579,7 @@
"," + mainList[0].HManagerID + "," + mainList[0].HEmpID + "," + mainList[0].HDeptID + ",'" + mainList[0].HRemark + "','" + mainList[0].HMaker +
"','" + mainList[0].HMakeDate + "','" + mainList[0].HChecker + "','" + mainList[0].HCheckDate + "','" + mainList[0].HOWNERTYPEID + "'," + mainList[0].HOWNERID + "," + mainList[0].HERPInterID + ",'" + mainList[0].HERPBillType + "'," + mainList[0].HPURCHASEORGID + "," + mainList[0].HSTOCKORGID + "," + mainList[0].HREQUIREORGID + "," +
mainList[0].HSTOCKGROUPID + ",'" + mainList[0].HSENDBILLNO + "','" + mainList[0].HLADBILLNO + "'," + mainList[0].HPURDEPTID + "," + mainList[0].HPURGROUPID + "," + mainList[0].HSUPPLYID + "," +
mainList[0].HSETTLEID + "," + mainList[0].HCHARGEID + ",'" + mainList[0].HBUSINESSTYPE + "','" + mainList[0].HSUPPLYADDRESS + "'," + mainList[0].HCORRESPONDORGID + "," + mainList[0].HPROVIDERCONTACTID + "," + mainList[0].HCurID + "," + mainList[0].HExRate + ",'" + mainList[0].HAddress + "'," + mainList[0].HWHID + "," + mainList[0].HInnerBillNo + ")";
mainList[0].HSETTLEID + "," + mainList[0].HCHARGEID + ",'" + mainList[0].HBUSINESSTYPE + "','" + mainList[0].HSUPPLYADDRESS + "'," + mainList[0].HCORRESPONDORGID + "," + mainList[0].HPROVIDERCONTACTID + "," + mainList[0].HCurID + "," + mainList[0].HExRate + ",'" + mainList[0].HAddress + "'," + mainList[0].HWHID + ",'" + mainList[0].HInnerBillNo + "'" + ")";
                oCN.RunProc(sql);
                //保存主表
                foreach (var oSub in subList)
WebAPI/Controllers/CJGL/Cj_StationEntrustInBillController.cs
@@ -167,9 +167,19 @@
                string sBillNo = sBillBarCode;
                //截取条码类型
                string BillNoType = sBillNo.Substring(0, Math.Min(3, sBillNo.Length));
                //截取条码类型2
                string BillNoType2 = sBillNo.Substring(0, Math.Min(4, sBillNo.Length));
                //截取内码
                string BillNo = sBillNo.Substring(3, Math.Min(sBillNo.Length - 3,sBillNo.Length));
                switch (BillNoType2)
                {
                    case "GXLZ"://工序流转派工
                        ds = oCN.RunProcReturn("select * from h_v_Sc_ProcExchSendWorkBill  where æ´¾å·¥å•据号 = '" + sBillNo + "'", "h_v_Sc_ProcExchSendWorkBill");
                        break;
                    case "GXLX"://流转卡
                        ds = oCN.RunProcReturn("select top 1 * from h_v_Sc_ProcessExchangeBillList  where å•据号= '" + sBillNo + "'", "h_v_Sc_ProcessExchangeBillList");
                        break;
                }
                switch (BillNoType)
                //得到信息
                {
@@ -234,10 +244,7 @@
                        break;
                    case "WLM"://物料码
                        ds = oCN.RunProcReturn("select * from h_v_Gy_MaterialList  where HItemID = '" + BillNo + "'", "h_v_Gy_MaterialList");
                        break;
                    case "GXL"://流转卡
                        ds = oCN.RunProcReturn("select top 1 * from h_v_Sc_ProcessExchangeBillList  where å•据号= '" + sBillNo + "'", "h_v_Sc_ProcessExchangeBillList");
                        break;
                        break;
                }
                //写入信息
WebAPI/Controllers/CJGL/Cj_StationOutBillController.cs
@@ -1677,100 +1677,101 @@
        #endregion
        #region æ˜Žç»† ä¿å­˜/编辑功能
        //[Route("Cj_StationOutBill/AddBill_Detail")]
        //[HttpPost]
        //public object AddBill_Detail([FromBody] JObject sMain)
        //{
        //    try
        //    {
        //        var _value = sMain["sMainSub"].ToString();
        //        string msg1 = _value.ToString();
        //        oCN.BeginTran();
        //        //保存主表
        //        objJsonResult = Add_Detail(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;
        [Route("Cj_StationOutBill/AddBill_Detail")]
        [HttpPost]
        public object AddBill_Detail([FromBody] JObject sMain)
        {
            try
            {
                var _value = sMain["sMainSub"].ToString();
                string msg1 = _value.ToString();
                oCN.BeginTran();
                //保存主表
                objJsonResult = Add_Detail(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 Add_Detail(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
        //    {
        //        List<ClsSc_StationOutBillSub_Emp> mainList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<ClsSc_StationOutBillSub_Emp>>(msg2);
        public json Add_Detail(string msg1)
        {
            string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
            string msg2 = sArray[0].ToString(); //表头数据
            string msg3 = sArray[1].ToString(); //表体数据
            var a = sArray[2].ToString();
            int OperationType = int.Parse(sArray[2].ToString()); // æ•°æ®ç±»åž‹ 1添加 3修改
            string user = sArray[3].ToString(); //用户名
            try
            {
                msg2 = "[" + msg2.ToString() + "]";
                List<ClsSc_StationOutBillSub_Emp> mainList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<ClsSc_StationOutBillSub_Emp>>(msg2);
                List<ClsSc_StationOutBillSub_Emp> subList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<ClsSc_StationOutBillSub_Emp>>(msg3);
        //        List<ClsSc_StationOutBillSub_Emp> subList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<ClsSc_StationOutBillSub_Emp>>(msg3);
        //        long HWorkEmpID = subList[0].HWorkEmpID;
        //        long HWorkSourceID = subList[0].HWorkSourceID;
        //        decimal HQty = subList[0].HQty;
        //        decimal HRate = subList[0].HRate;
        //        decimal HProcPrice = subList[0].HProcPrice;
        //        decimal HMoney = subList[0].HMoney;
        //        long HWorkProcID = mainList[0].HWorkProcID;
                long HWorkEmpID = subList[0].HWorkEmpID;
                long HWorkSourceID = subList[0].HWorkSourceID;
                decimal HQty = subList[0].HQty;
                decimal HRate = subList[0].HRate;
                decimal HProcPrice = subList[0].HProcPrice;
                decimal HMoney = subList[0].HMoney;
                long HWorkProcID = mainList[0].HWorkProcID;
        //        foreach (ClsSc_StationOutBillSub_Emp oSub in subList)
        //        {
        //            //ds = oCN.RunProcReturn("select * from h_v_IF_ICMOBillList where hmainid=" + HInterID + " and å•据号='" + HBillNo + "'", "h_v_IF_ICMOBillList");
                foreach (ClsSc_StationOutBillSub_Emp oSub in subList)
                {
                    //ds = oCN.RunProcReturn("select * from h_v_IF_ICMOBillList where hmainid=" + HInterID + " and å•据号='" + HBillNo + "'", "h_v_IF_ICMOBillList");
        //            if ((OperationType == 1 || OperationType == 2) && ds.Tables[0].Rows.Count == 0)//新增
        //            {
        //                //主表
        //                oCN.RunProc(@"Insert Into Sc_StationOutBillSub_Emp
        //                    (HBillNo_bak ,HCloseMan ,HEntryCloseDate ,HCloseType ,HRemark ,HSourceInterID
        //                    ,HSourceEntryID ,HSourceBillNo ,HSourceBillType ,HRelationQty ,HRelationMoney
        //                    ,HWorkEmpID ,HWorkSourceID ,HQty ,HRate ,HProcPrice
        //                    ,HMoney ,HWorkProcID)
        //                    values('3710',1," + HInterID + ",'" + HBillNo + "','" + HDate + "'," + HPRDORGID +
        //                "," + DateTime.Now.Year + "," + DateTime.Now.Month + ",'" + HRemark + "','" + HMaker + "',getdate()" +
        //                ",'" + HSeOrderBillNo + "'," + HSeOrderInterID + "," + HSeOrderEntryID + "," + HEmpID + "," + HCusID +
        //                "," + HCenterID + ",0,0,0,0," + HBomID + ",'','') ");
        //            }
        //        }
                    if ((OperationType == 1 || OperationType == 2))//新增 && ds.Tables[0].Rows.Count == 0
                    {
                        string sql = string.Empty;
                        sql = $@"
                        Insert into Sc_StationOutBillSub_Emp
                        (HInterID,HEntryID,HBillNo_bak ,HRemark ,HSourceInterID
                        ,HSourceEntryID ,HSourceBillNo ,HSourceBillType ,HRelationQty ,HRelationMoney
                        ,HWorkEmpID ,HWorkSourceID ,HQty ,HRate ,HProcPrice ,HMoney ,HWorkProcID)
                        values(" + 1 + "," + 2 + "," + "'" + mainList[0].HBillNo_bak + "','" + "HRemark" + "'," + 0 + "," + 0 + ",'" + " " + "','" + "HSource" + "'," +
                        "0" + "," + 0 + "," + 0 + "," + 0 + "," + 0 + "," + 0 + "," + 0 + "," + 0 + "," + 0 + ")";
        //        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;
        //    }
        //}
                        oCN.RunProc(sql);
                    }
                }
                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;
            }
        }
        #endregion
    }
}
WebAPI/Controllers/CJGL/Sc_ProcExchSendWorkBillController.cs
New file
@@ -0,0 +1,270 @@
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using Pub_Class;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Web.Http;
using WebAPI.Models;
namespace WebAPI.Controllers.CJGL
{
    public class Sc_ProcExchSendWorkBillController : ApiController
    {
        public DBUtility.ClsPub.Enum_BillStatus BillStatus;
        private json objJsonResult = new json();
        SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
        DataSet ds;
        #region å·¥åºæ´¾å·¥å•列表
        [Route("Sc_ProcExchSendWorkBill/Sc_ProcExchSendWorkBillList")]
        [HttpGet]
        public object Sc_ProcExchSendWorkBillList(string sWhere, string user)
        {
            try
            {
                List<object> columnNameList = new List<object>();
                string sql1 = "select * from h_v_Sc_ProcExchSendWorkBillList where 1 = 1  ";
                string sql = sql1 + sWhere + " order by hmainid desc";
                ds = oCN.RunProcReturn(sql, "h_v_Sc_ProcExchSendWorkBillList");
                //添加列名
                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.list = columnNameList;
                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("Sc_ProcExchSendWorkBill/GetProcessExchangeBillSub")]
        [HttpGet]
        public object GetProcessExchangeBillSub_cf(string sWhere)
        {
            DataSet ds;
            try
            {
                SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
                string sql = string.Format(@"select * from h_v_Sc_ProcessExchangeBillQuerySub_SendWork");
                ds = oCN.RunProcReturn(sql + sWhere + " order by æµæ°´å· ", "h_v_Sc_ProcessExchangeBillQuerySub_SendWork");
                objJsonResult.code = "0";
                objJsonResult.count = 1;
                objJsonResult.Message = "获取信息成功!";
                objJsonResult.data = ds.Tables[0];
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "没有返回任何记录!" + e.ToString();
                objJsonResult.data = null;
            }
            return objJsonResult;
        }
        #endregion
        #region å·¥åºæ´¾å·¥å• ä¿å­˜/编辑
        /// <summary>
        /// å·¥åºæ´¾å·¥å• ä¿å­˜
        /// </summary>
        /// <param name="msg"></param>
        /// <returns></returns>
        [Route("Sc_ProcExchSendWorkBill/SaveProcessSendWork")]
        [HttpPost]
        public object SaveProcessSendWork([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 msg4 = sArray[2].ToString();
            string UserName = "";
            ListModels oListModels = new ListModels();
            try
            {
                DAL.ClsSc_ProcExchSendWorkBill oBill = new DAL.ClsSc_ProcExchSendWorkBill();
                List<Model.ClsSc_ProcExchSendWorkBillMain> lsmain = new List<Model.ClsSc_ProcExchSendWorkBillMain>();
                msg2 = msg2.Replace("\\", "");
                msg2 = msg2.Replace("\n", "");  //\n
                lsmain = oListModels.getObjectByJson_ClsSc_ProcExchSendWorkBillMain(msg2);
                foreach (Model.ClsSc_ProcExchSendWorkBillMain oItem in lsmain)
                {
                    //oItem.HMaker = "";
                    UserName = oItem.HMaker;  //制单人
                    oItem.HBillType = "3798";
                    oItem.HBillSubType = "3798";
                    oItem.HBillStatus = 1;
                    DBUtility.ClsPub.CurUserName = UserName;
                    oItem.HYear = DBUtility.ClsPub.isLong(DateTime.Now.Year);
                    if (DBUtility.ClsPub.isStrNull(oItem.HDate) == "")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "保存失败!没有单据日期,无法保存!";
                        objJsonResult.data = 1;
                        return objJsonResult;
                    }
                    oBill.omodel = oItem;
                }
                //表体数据
                //按 },{来拆分数组 //去掉【和】
                msg3 = msg3.Substring(1, msg3.Length - 2);
                msg3 = msg3.Replace("\\", "");
                msg3 = msg3.Replace("\n", "");  //\n
                //msg2 = msg2.Replace("'", "’");
                List<Model.ClsSc_ProcExchSendWorkBillSub> ls = new List<Model.ClsSc_ProcExchSendWorkBillSub>();
                ls = oListModels.getObjectByJson_ClsSc_ProcExchSendWorkBillSub(msg3);
                int i = 0;
                foreach (Model.ClsSc_ProcExchSendWorkBillSub oItemSub in ls)
                {
                    i++;
                    oItemSub.HEntryID = i;
                    //oItemSub.HCloseMan = "";       //行关闭
                    oItemSub.HEntryCloseDate = DBUtility.ClsPub.isDate(DateTime.Now);
                    oItemSub.HCloseType = false;   //关闭类型
                    //oItemSub.HRemark = "";         //备注
                    oItemSub.HSourceInterID = 0;     // æºå•主内码
                    oItemSub.HSourceEntryID = 0;   //源单子内码
                    //oItemSub.HSourceBillNo = "";  //源单单号
                    //oItemSub.HSourceBillType = ""; //源单类型
                    oItemSub.HRelationQty = 0;     //关联数量
                    oBill.DetailColl.Add(oItemSub);
                }
                //保存
                //保存完毕后处理
                bool bResult;
                if (oBill.omodel.HInterID == 0)
                {
                    // bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo);
                    bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo);
                }
                else
                {
                    bResult = oBill.ModifyBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo);
                }
                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_ProcExchSendWorkBill/DelProcessSendWork")]
        [HttpGet]
        public object DelProcessSendWork(string HInterID, string user)
        {
            Int64 lngBillKey = 0;
            lngBillKey = DBUtility.ClsPub.isLong(HInterID);
            if (lngBillKey == 0)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "单据ID为空!";
                objJsonResult.data = null;
                return objJsonResult;
            }
            DAL.ClsSc_ProcExchSendWorkBill oBill = new DAL.ClsSc_ProcExchSendWorkBill();
            if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo))
            {
                ds = oCN.RunProcReturn("select * from Sc_ProcExchSendWorkBillMain where HInterID=" + lngBillKey, "Sc_ProcExchSendWorkBillMain");
                if (int.Parse(ds.Tables[0].Rows[0]["HBillStatus"].ToString()) > 1)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "单据当前处于不能删除状态,不能删除!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                if (ds.Tables[0].Rows[0]["HChecker"].ToString() != "")
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "单据已经审核,不能删除!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                bool IsDete = oBill.DeleteBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo);
                if (IsDete)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 1;
                    objJsonResult.Message = DBUtility.ClsPub.sExeReturnInfo;
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                else
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = DBUtility.ClsPub.sExeReturnInfo;
                    objJsonResult.data = null;
                    return objJsonResult;
                }
            }
            else
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "单据未找到";
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        //#endregion
    }
}
WebAPI/Controllers/CJGL/Sc_ProcessSendWorkController.cs
@@ -1,253 +1,253 @@
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using Pub_Class;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Web.Http;
using WebAPI.Models;
//using Newtonsoft.Json;
//using Newtonsoft.Json.Linq;
//using Pub_Class;
//using System;
//using System.Collections;
//using System.Collections.Generic;
//using System.Data;
//using System.Data.SqlClient;
//using System.Web.Http;
//using WebAPI.Models;
namespace WebAPI.Controllers
{
    public class Sc_ProcessSendWorkController : ApiController
    {
        private json objJsonResult = new json();
        public DataSet ds = new DataSet();
        SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
//namespace WebAPI.Controllers
//{
//    public class Sc_ProcessSendWorkController : ApiController
//    {
//        private json objJsonResult = new json();
//        public DataSet ds = new DataSet();
//        SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
        #region å·¥åºæ´¾å·¥å• åˆ—表
        /// <summary>
        /// å·¥åºæ´¾å·¥å•列表
        /// </summary>
        /// <returns></returns>
        [Route("Sc_ProcessSendWork/Sc_ProcessSendWorkList")]
        [HttpGet]
        public object Sc_ProcessSendWorkList(string sWhere, string user)
        {
            try
            {
                List<object> columnNameList = new List<object>();
//        #region å·¥åºæ´¾å·¥å• åˆ—表
//        /// <summary>
//        /// å·¥åºæ´¾å·¥å•列表
//        /// </summary>
//        /// <returns></returns>
//        [Route("Sc_ProcessSendWork/Sc_ProcessSendWorkList")]
//        [HttpGet]
//        public object Sc_ProcessSendWorkList(string sWhere, string user)
//        {
//            try
//            {
//                List<object> columnNameList = new List<object>();
                ds = oCN.RunProcReturn("select * from h_v_Sc_ProcessSendWorkList where 1=1 " + sWhere, "h_v_Sc_ProcessSendWorkList");
//                ds = oCN.RunProcReturn("select * from h_v_Sc_ProcessSendWorkList where 1=1 " + sWhere, "h_v_Sc_ProcessSendWorkList");
                //添加列名
                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列对象的列名
                }
//                //添加列名
//                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 = "返回记录成功!";
                objJsonResult.data = ds.Tables[0];
                objJsonResult.list = columnNameList;
                return objJsonResult;
//                objJsonResult.code = "1";
//                objJsonResult.count = 1;
//                objJsonResult.Message = "返回记录成功!";
//                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
//            }
//            catch (Exception ex)
//            {
//                objJsonResult.code = "0";
//                objJsonResult.count = 0;
//                objJsonResult.Message = "没有返回任何记录!" + ex.ToString();
//                objJsonResult.data = null;
//                return objJsonResult;
//            }
//        }
//        #endregion
        #region å·¥åºæ´¾å·¥å• ä¿å­˜/编辑
        /// <summary>
        /// å·¥åºæ´¾å·¥å• ä¿å­˜
        /// </summary>
        /// <param name="msg"></param>
        /// <returns></returns>
        [Route("Sc_ProcessSendWork/SaveProcessSendWork")]
        [HttpPost]
        public object SaveProcessSendWork([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 msg4 = sArray[2].ToString();
//        #region å·¥åºæ´¾å·¥å• ä¿å­˜/编辑
//        /// <summary>
//        /// å·¥åºæ´¾å·¥å• ä¿å­˜
//        /// </summary>
//        /// <param name="msg"></param>
//        /// <returns></returns>
//        [Route("Sc_ProcessSendWork/SaveProcessSendWork")]
//        [HttpPost]
//        public object SaveProcessSendWork([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 msg4 = sArray[2].ToString();
            string UserName = "";
            ListModels oListModels = new ListModels();
            try
            {
                DAL.ClsSc_ProcessSendWork oBill = new DAL.ClsSc_ProcessSendWork();
                List<Model.ClsSc_ProcessSendWorkMain> lsmain = new List<Model.ClsSc_ProcessSendWorkMain>();
                msg2 = msg2.Replace("\\", "");
                msg2 = msg2.Replace("\n", "");  //\n
                lsmain = oListModels.getObjectByJson_ClsSc_ProcessSendWorkMain(msg2);
                foreach (Model.ClsSc_ProcessSendWorkMain oItem in lsmain)
                {
                    //oItem.HMaker = "";
                    UserName = oItem.HMaker;  //制单人
                    oItem.HBillType = "3712";
                    oItem.HBillSubType = "3712";
                    oItem.HBillStatus = 1;
                    DBUtility.ClsPub.CurUserName = UserName;
                    oItem.HYear = DBUtility.ClsPub.isLong(DateTime.Now.Year);
//            string UserName = "";
//            ListModels oListModels = new ListModels();
//            try
//            {
//                DAL.ClsSc_ProcessSendWork oBill = new DAL.ClsSc_ProcessSendWork();
//                List<Model.ClsSc_ProcessSendWorkMain> lsmain = new List<Model.ClsSc_ProcessSendWorkMain>();
//                msg2 = msg2.Replace("\\", "");
//                msg2 = msg2.Replace("\n", "");  //\n
//                lsmain = oListModels.getObjectByJson_ClsSc_ProcessSendWorkMain(msg2);
//                foreach (Model.ClsSc_ProcessSendWorkMain oItem in lsmain)
//                {
//                    //oItem.HMaker = "";
//                    UserName = oItem.HMaker;  //制单人
//                    oItem.HBillType = "3712";
//                    oItem.HBillSubType = "3712";
//                    oItem.HBillStatus = 1;
//                    DBUtility.ClsPub.CurUserName = UserName;
//                    oItem.HYear = DBUtility.ClsPub.isLong(DateTime.Now.Year);
                    if (DBUtility.ClsPub.isStrNull(oItem.HDate) == "")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "保存失败!没有单据日期,无法保存!";
                        objJsonResult.data = 1;
                        return objJsonResult;
                    }
                    oBill.omodel = oItem;
                }
                //表体数据
                //按 },{来拆分数组 //去掉【和】
                msg3 = msg3.Substring(1, msg3.Length - 2);
                msg3 = msg3.Replace("\\", "");
                msg3 = msg3.Replace("\n", "");  //\n
                //msg2 = msg2.Replace("'", "’");
                List<Model.ClsSc_ProcessSendWorkSub> ls = new List<Model.ClsSc_ProcessSendWorkSub>();
                ls = oListModels.getObjectByJson_ClsSc_ProcessSendWorkSub(msg3);
                int i = 0;
                foreach (Model.ClsSc_ProcessSendWorkSub oItemSub in ls)
                {
//                    if (DBUtility.ClsPub.isStrNull(oItem.HDate) == "")
//                    {
//                        objJsonResult.code = "0";
//                        objJsonResult.count = 0;
//                        objJsonResult.Message = "保存失败!没有单据日期,无法保存!";
//                        objJsonResult.data = 1;
//                        return objJsonResult;
//                    }
//                    oBill.omodel = oItem;
//                }
//                //表体数据
//                //按 },{来拆分数组 //去掉【和】
//                msg3 = msg3.Substring(1, msg3.Length - 2);
//                msg3 = msg3.Replace("\\", "");
//                msg3 = msg3.Replace("\n", "");  //\n
//                //msg2 = msg2.Replace("'", "’");
//                List<Model.ClsSc_ProcessSendWorkSub> ls = new List<Model.ClsSc_ProcessSendWorkSub>();
//                ls = oListModels.getObjectByJson_ClsSc_ProcessSendWorkSub(msg3);
//                int i = 0;
//                foreach (Model.ClsSc_ProcessSendWorkSub oItemSub in ls)
//                {
                    i++;
                    oItemSub.HEntryID = i;
                    //oItemSub.HCloseMan = "";       //行关闭
                    oItemSub.HEntryCloseDate = DBUtility.ClsPub.isDate(DateTime.Now);
                    oItemSub.HCloseType = false;   //关闭类型
                    //oItemSub.HRemark = "";         //备注
                    oItemSub.HSourceInterID = 0;     // æºå•主内码
                    oItemSub.HSourceEntryID = 0;   //源单子内码
                    //oItemSub.HSourceBillNo = "";  //源单单号
                    //oItemSub.HSourceBillType = ""; //源单类型
                    oItemSub.HRelationQty = 0;     //关联数量
                                                   //oItemSub.HRelationMoney = 0;   //关联金额
                                                   //HMaterID = "";//配件代码
                                                   //HUnitID = "";//单位代码
                                                   //HQty = "";//实际用量
                                                   //HQtyMust = "";//单位用量
                                                   //HRemark = "";//备注
//                    i++;
//                    oItemSub.HEntryID = i;
//                    //oItemSub.HCloseMan = "";       //行关闭
//                    oItemSub.HEntryCloseDate = DBUtility.ClsPub.isDate(DateTime.Now);
//                    oItemSub.HCloseType = false;   //关闭类型
//                    //oItemSub.HRemark = "";         //备注
//                    oItemSub.HSourceInterID = 0;     // æºå•主内码
//                    oItemSub.HSourceEntryID = 0;   //源单子内码
//                    //oItemSub.HSourceBillNo = "";  //源单单号
//                    //oItemSub.HSourceBillType = ""; //源单类型
//                    oItemSub.HRelationQty = 0;     //关联数量
//                                                   //oItemSub.HRelationMoney = 0;   //关联金额
//                                                   //HMaterID = "";//配件代码
//                                                   //HUnitID = "";//单位代码
//                                                   //HQty = "";//实际用量
//                                                   //HQtyMust = "";//单位用量
//                                                   //HRemark = "";//备注
                    oBill.DetailColl.Add(oItemSub);
//                    oBill.DetailColl.Add(oItemSub);
                }
                //保存
                //保存完毕后处理
                bool bResult;
                if (oBill.omodel.HInterID == 0)
                {
                    // bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo);
                    bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo);
                }
                else
                {
                    bResult = oBill.ModifyBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo);
                }
                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
//                }
//                //保存
//                //保存完毕后处理
//                bool bResult;
//                if (oBill.omodel.HInterID == 0)
//                {
//                    // bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo);
//                    bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo);
//                }
//                else
//                {
//                    bResult = oBill.ModifyBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo);
//                }
//                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 å·¥åºæ´¾å·¥å• åˆ é™¤
        /// <summary>
        /// å·¥åºæ´¾å·¥å•删除
        /// </summary>
        /// <returns></returns>
        [Route("Sc_ProcessSendWork/DelProcessSendWork")]
        [HttpGet]
        public object DelProcessSendWork(string HInterID, string user)
        {
            Int64 lngBillKey = 0;
            lngBillKey = DBUtility.ClsPub.isLong(HInterID);
            if (lngBillKey == 0)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "单据ID为空!";
                objJsonResult.data = null;
                return objJsonResult;
            }
            DAL.ClsSc_ProcessSendWork oBill = new DAL.ClsSc_ProcessSendWork();
            if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo))
            {
                ds = oCN.RunProcReturn("select * from Sc_ProcessSendWorkMain where HInterID=" + lngBillKey, "Sc_ProcessSendWorkMain");
                if (int.Parse(ds.Tables[0].Rows[0]["HBillStatus"].ToString()) > 1)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "单据当前处于不能删除状态,不能删除!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
//        #region å·¥åºæ´¾å·¥å• åˆ é™¤
//        /// <summary>
//        /// å·¥åºæ´¾å·¥å•删除
//        /// </summary>
//        /// <returns></returns>
//        [Route("Sc_ProcessSendWork/DelProcessSendWork")]
//        [HttpGet]
//        public object DelProcessSendWork(string HInterID, string user)
//        {
//            Int64 lngBillKey = 0;
//            lngBillKey = DBUtility.ClsPub.isLong(HInterID);
//            if (lngBillKey == 0)
//            {
//                objJsonResult.code = "0";
//                objJsonResult.count = 0;
//                objJsonResult.Message = "单据ID为空!";
//                objJsonResult.data = null;
//                return objJsonResult;
//            }
//            DAL.ClsSc_ProcessSendWork oBill = new DAL.ClsSc_ProcessSendWork();
//            if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo))
//            {
//                ds = oCN.RunProcReturn("select * from Sc_ProcessSendWorkMain where HInterID=" + lngBillKey, "Sc_ProcessSendWorkMain");
//                if (int.Parse(ds.Tables[0].Rows[0]["HBillStatus"].ToString()) > 1)
//                {
//                    objJsonResult.code = "0";
//                    objJsonResult.count = 0;
//                    objJsonResult.Message = "单据当前处于不能删除状态,不能删除!";
//                    objJsonResult.data = null;
//                    return objJsonResult;
//                }
                if (ds.Tables[0].Rows[0]["HChecker"].ToString() != "")
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "单据已经审核,不能删除!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
//                if (ds.Tables[0].Rows[0]["HChecker"].ToString() != "")
//                {
//                    objJsonResult.code = "0";
//                    objJsonResult.count = 0;
//                    objJsonResult.Message = "单据已经审核,不能删除!";
//                    objJsonResult.data = null;
//                    return objJsonResult;
//                }
                bool IsDete = oBill.DeleteBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo);
                if (IsDete)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 1;
                    objJsonResult.Message = DBUtility.ClsPub.sExeReturnInfo;
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                else
                {
//                bool IsDete = oBill.DeleteBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo);
//                if (IsDete)
//                {
//                    objJsonResult.code = "0";
//                    objJsonResult.count = 1;
//                    objJsonResult.Message = DBUtility.ClsPub.sExeReturnInfo;
//                    objJsonResult.data = null;
//                    return objJsonResult;
//                }
//                else
//                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = DBUtility.ClsPub.sExeReturnInfo;
                    objJsonResult.data = null;
                    return objJsonResult;
                }
            }
            else
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "单据未找到";
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
    }
}
//                    objJsonResult.code = "0";
//                    objJsonResult.count = 0;
//                    objJsonResult.Message = DBUtility.ClsPub.sExeReturnInfo;
//                    objJsonResult.data = null;
//                    return objJsonResult;
//                }
//            }
//            else
//            {
//                objJsonResult.code = "0";
//                objJsonResult.count = 0;
//                objJsonResult.Message = "单据未找到";
//                objJsonResult.data = null;
//                return objJsonResult;
//            }
//        }
//        #endregion
//    }
//}
WebAPI/ListModels.cs
@@ -1556,6 +1556,24 @@
            return list;
        }
        ///流转卡工序派工单 ä¸»è¡¨
        ///ClsSc_ProcExchWorkBackBillMain
        public List<Model.ClsSc_ProcExchSendWorkBillMain> getObjectByJson_ClsSc_ProcExchSendWorkBillMain(string jsonString)
        {
            jsonString = "[" + jsonString.ToString() + "]";
            List<Model.ClsSc_ProcExchSendWorkBillMain> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsSc_ProcExchSendWorkBillMain>>(jsonString);
            return list;
        }
        ///流转卡工序派工单 å­è¡¨
        ///ClsSc_ProcExchWorkBackBillMain
        public List<Model.ClsSc_ProcExchSendWorkBillSub> getObjectByJson_ClsSc_ProcExchSendWorkBillSub(string jsonString)
        {
            jsonString = "[" + jsonString.ToString() + "]";
            List<Model.ClsSc_ProcExchSendWorkBillSub> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsSc_ProcExchSendWorkBillSub>>(jsonString);
            return list;
        }
        ///设备投产检验验收单 å­è¡¨
        ///ClsSb_EquipWorkBeforeCheckBillSub
        public List<Model.ClsSb_EquipWorkBeforeCheckBillSub> getObjectByJson_ClsSb_EquipWorkBeforeCheckBillSub(string jsonString)
WebAPI/WebAPI.csproj
@@ -404,6 +404,7 @@
    <Compile Include="Controllers\CJGL\Cj_StationEntrustOutBillController.cs" />
    <Compile Include="Controllers\CJGL\Sc_ProcExchRecordBackBillController.cs" />
    <Compile Include="Controllers\CJGL\Sc_ProcessSendWorkController.cs" />
    <Compile Include="Controllers\CJGL\Sc_ProcExchSendWorkBillController.cs" />
    <Compile Include="Controllers\CJGL\Sc_ProcExchWorkBackBillController.cs" />
    <Compile Include="Controllers\CJGL\Sc_WorkBillAutoSortBillMainController.cs" />
    <Compile Include="Controllers\Gy_MateMouldController.cs" />
@@ -1000,6 +1001,7 @@
    <Folder Include="Views\Sc_ProcessExchangeIssueBill\" />
    <Folder Include="Views\Sc_ProcessSendWork\" />
    <Folder Include="Views\Sc_ProcExchRecordBackBill\" />
    <Folder Include="Views\Sc_ProcExchSendWorkBill\" />
    <Folder Include="Views\Sc_WorkBillAutoSortBillMain\" />
    <Folder Include="Views\Sc_WorkBillSortBill\" />
    <Folder Include="Views\Sc_WorkDemandPlanBill\" />