zrg
2024-03-15 d1763a58e75722a3e3dedfe4e59fcfc9f8fd586a
Merge branch 'master' of http://101.37.171.70:10101/r/MES-WEB-API
6个文件已修改
9个文件已添加
2231 ■■■■■ 已修改文件
DAL/DAL.csproj 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DAL/生产管理/设备管理/ClsGy_FixCardBill.cs 239 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Model/Model.csproj 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Model/器具管理/ClsSc_MouldLowerBillMain.cs 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Model/器具管理/ClsSc_MouldLowerBillSub.cs 26 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Model/器具管理/ClsSc_MouldUpperBillMain.cs 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Model/器具管理/ClsSc_MouldUpperBillSub.cs 26 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Model/生产管理/设备管理/ClsGy_FixCardBillMain.cs 32 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Model/生产管理/设备管理/ClsGy_FixCardBillSub_Emp.cs 22 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Controllers/MJGL/Sc_MouldUpperBillController.cs 1231 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Controllers/SBGL/Gy_FixCardBillController.cs 542 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Controllers/XSGL/Xs_OutDoorCheckBillController.cs 40 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/DLL/ClsSc_ICMOReportBill.cs 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/ListModels.cs 25 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/WebAPI.csproj 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DAL/DAL.csproj
@@ -626,6 +626,7 @@
    <Compile Include="生产管理\模具管理\ClsSc_MouldStatusChangeBill.cs" />
    <Compile Include="生产管理\设备管理\ClsGy_EquipFileMain.cs" />
    <Compile Include="生产管理\设备管理\ClsGy_EquipTypeBill.cs" />
    <Compile Include="生产管理\设备管理\ClsGy_FixCardBill.cs" />
    <Compile Include="生产管理\设备管理\ClsSb_EquipWorkBeforeCheckBill.cs" />
    <Compile Include="生产管理\设备管理\ClsSb_EquipStockInCheckBill.cs" />
    <Compile Include="生产管理\设备管理\ClsSb_EquipSparepartsBill.cs" />
DAL/Éú²ú¹ÜÀí/É豸¹ÜÀí/ClsGy_FixCardBill.cs
New file
@@ -0,0 +1,239 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
namespace DAL
{
    public  class ClsGy_FixCardBill : DBUtility.ClsXt_BaseBill
    {
        public Model.ClsGy_FixCardBillMain omodel = new Model.ClsGy_FixCardBillMain();
        public List<Model.ClsGy_FixCardBillSub_Emp> DetailColl = new List<Model.ClsGy_FixCardBillSub_Emp>();
        public ClsGy_FixCardBill()
        {
            base.MvarItemKeySub = "Gy_FixCardBillSub_Emp";
            base.MvarItemKeySub2 = "";
            base.MvarItemKeySub3 = "";
            base.MvarItemKeySub4 = "";
            base.MvarItemKey= "Gy_FixCardBillMain";
            base.MvarReportTitle="固定资产卡片";
            base.BillType = "3335";
            base.HBillSubType = "3335";
        }
        #region å›ºå®šä»£ç 
        ~ClsGy_FixCardBill()
        {
            DetailColl = null;
        }
        #endregion   è‡ªå®šä¹‰æ–¹æ³•
        //修改单据
        public override bool ModifyBill(Int64 lngBillKey, ref string sReturn)
        {
            try
            {
                //
                oCn.BeginTran();
                //更新主表
                oCn.RunProc("UpDate Gy_FixCardBillMain set  " +
                " HBillNo='" + omodel.HBillNo + "'" +  //固定赋值===============
                ",HRemark='" + omodel.HRemark + "'" +
                ",HUpDater='" + omodel.HMaker + "'" +
                ",HUpDateDate=getdate()" +
                //========================================
                ",HCardNumber='" + omodel.HCardNumber + "'" +
                ",HCardName='" + omodel.HCardName + "'" +
                ",HCardModel ='" + omodel.HCardModel + "'" +
                ",HMaterID='" + omodel.HMaterID + "'" +
                ",HUnitID='" + omodel.HUnitID + "'" +
                ",HCardQty='" + omodel.HCardQty + "'" +
                ",HCardForm='" + omodel.HCardForm + "'" +
                ",HCard='" + omodel.HCard + "'" +
                ",HOutComDate='" + omodel.HOutComDate + "'" +
                ",HOutComNo='" + omodel.HOutComNo + "'" +
                ",HBeginUseDate='" + omodel.HBeginUseDate + "'" +
                ",HCardTypeID='" + omodel.HCardTypeID + "'" +
                ",HCardStatusID='" + omodel.HCardStatusID + "'" +
                ",HCardChangeTypeID='" + omodel.HCardChangeTypeID + "'" +
                ",HBarCode='" + omodel.HBarCode + "'" +
                ",HWorkArea='" + omodel.HWorkArea + "'" +
                ",HLogo='" + omodel.HLogo + "'" +
                ",HSellSupID='" + omodel.HSellSupID + "'" +
                ",HMakeSupID='" + omodel.HMakeSupID + "'" +
                ",HOrgID='" + omodel.HOrgID + "'" +
                ",HOwnerID='" + omodel.HOwnerID + "'" +
                " where HInterID=" + lngBillKey.ToString());
                //删除关联
                DeleteRelation(ref sReturn, lngBillKey);
                //删除子表
                DeleteBillSub(lngBillKey);
                //插入子表
                omodel.HInterID = lngBillKey;
                foreach (Model.ClsGy_FixCardBillSub_Emp oSub in DetailColl)
                {
                    oCn.RunProc("Insert into Gy_FixCardBillSub_Emp " +
                      " (HInterID,HBillNo_bak ,HEntryID,HRemark," +
                      "HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney," +
                      "HDeptID,HUseEmpID,HRepairEmpID,HCardAddr,HAddress,HSetupDate,HAvgRate,HProjectMoneyID," +
                      "HBeginDate,HEndDate" +
                      ") values("
                      + omodel.HInterID.ToString() + ",'" + omodel.HBillNo + "'," + oSub.HEntryID.ToString() +
                      ",'" + oSub.HRemark + "'" +
                      "," + oSub.HSourceInterID.ToString() + "," + oSub.HSourceEntryID.ToString() + ",'" + oSub.HSourceBillNo + "','" + oSub.HSourceBillType + "'," + oSub.HRelationQty.ToString() + "," + oSub.HRelationMoney.ToString() +
                      "," + oSub.HDeptID + "," + oSub.HUseEmpID + "," + oSub.HRepairEmpID +
                      ",'" + oSub.HCardAddr + "','" + oSub.HAddress + "','" + oSub.HSetupDate + "'," + oSub.HAvgRate + "," + oSub.HProjectMoneyID + ",'" +
                      oSub.HBeginDate + "','" + oSub.HEndDate + "'" +
                      ") ");
                }
                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 Gy_FixCardBillMain" +
                "(HBillType,HBillSubType,HInterID,HBillNo,HDate,HMaker,HMakeDate,HYear,HPeriod,HRemark,HBillStatus," +
                "HMainSourceBillType,HMainSourceInterID,HMainSourceEntryID,HMainSourceBillNo," +
                "HCardNumber,HCardName,HCardModel,HMaterID,HUnitID,HCardQty,HCardForm,HCard,HOutComDate,HOutComNo,HBeginUseDate," +
                "HCardTypeID,HCardStatusID,HCardChangeTypeID,HBarCode,HWorkArea,HLogo,HSellSupID,HMakeSupID,HOrgID,HOwnerID" +
                ") "+
                " values('" + this.BillType + "','"  + this.HBillSubType + "'," +omodel.HInterID.ToString() + ",'" + omodel.HBillNo + "','" + omodel.HDate +
                "','" + omodel.HMaker + "',getdate()" + "," + omodel.HYear.ToString() + "," + omodel.HPeriod.ToString() + ",'" + omodel.HRemark +
                "'," + omodel.HBillStatus + ",'" + omodel.HMainSourceBillType + "','" +omodel.HMainSourceInterID + "'," + omodel.HMainSourceEntryID +
                ",'" + omodel.HMainSourceBillNo + "','" + omodel.HCardNumber + "','" + omodel.HCardName + "','" + omodel.HCardModel + "'," + omodel.HMaterID +
                "," + omodel.HUnitID + "," + omodel.HCardQty + ",'" + omodel.HCardForm + "','" +  omodel.HCard + "','" + omodel.HOutComDate +
                "','" + omodel.HOutComNo + "','" + omodel.HBeginUseDate + "'," + omodel.HCardTypeID + "," +  omodel.HCardStatusID + "," + omodel.HCardChangeTypeID +
                ",'" + omodel.HBarCode + "','" + omodel.HWorkArea + "','" + omodel.HLogo + "'," + omodel.HSellSupID + "," + omodel.HMakeSupID + "," + omodel.HOrgID +
                "," + omodel.HOwnerID +
                ") ");
                //插入子表
                foreach (Model.ClsGy_FixCardBillSub_Emp oSub in DetailColl)
                {
                    oCn.RunProc("Insert into Gy_FixCardBillSub_Emp " +
                      " (HInterID,HBillNo_bak ,HEntryID,HRemark," +
                      "HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney," +
                      "HDeptID,HUseEmpID,HRepairEmpID,HCardAddr,HAddress,HSetupDate,HAvgRate,HProjectMoneyID," +
                      "HBeginDate,HEndDate" +
                      ") values("
                      + omodel.HInterID.ToString() + ",'" + omodel.HBillNo + "'," + oSub.HEntryID.ToString() +
                      ",'" + oSub.HRemark + "'" +
                      "," + oSub.HSourceInterID.ToString() + "," + oSub.HSourceEntryID.ToString() + ",'" + oSub.HSourceBillNo + "','" + oSub.HSourceBillType + "'," + oSub.HRelationQty.ToString() + "," + oSub.HRelationMoney.ToString() +
                      "," + oSub.HDeptID + "," + oSub.HUseEmpID + "," + oSub.HRepairEmpID +
                      ",'" + oSub.HCardAddr + "','" + oSub.HAddress + "','" + oSub.HSetupDate + "'," + oSub.HAvgRate + "," + oSub.HProjectMoneyID + ",'" +
                      oSub.HBeginDate + "','" + oSub.HEndDate + "'" +
                      ") ");
                }
                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 Gy_FixCardBillMain Where HInterID=" + lngBillKey.ToString(), "Gy_FixCardBillMain");
                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();
                //========================================================
                //==
                //
                //循环
                DataSet DsSub ;
                DsSub = oCn.RunProcReturn("Select * from Gy_FixCardBillSub_Emp Where HInterID=" + lngBillKey.ToString() + " order by HEntryID ", "Gy_FixCardBillSub_Emp");
                DetailColl.Clear();//清空
                for (int i = 0; i < DsSub.Tables[0].Rows.Count; i++)
                {
                    Model.ClsGy_FixCardBillSub_Emp oSub = new Model.ClsGy_FixCardBillSub_Emp();
                    // å›ºå®šèµ‹å€¼===============================================
                    oSub.HInterID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HInterID"]);
                    oSub.HEntryID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HEntryID"]);
                    oSub.HSourceInterID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSourceInterID"]);
                    oSub.HSourceEntryID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSourceEntryID"]);
                    oSub.HSourceBillType = DsSub.Tables[0].Rows[i]["HSourceBillType"].ToString().Trim();
                    oSub.HSourceBillNo = DsSub.Tables[0].Rows[i]["HSourceBillNo"].ToString().Trim();
                    oSub.HRelationQty = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HRelationQty"]);
                    oSub.HRelationMoney = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HRelationMoney"]);
                    oSub.HCloseMan =  DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HCloseMan"]);
                    oSub.HCloseType = DBUtility.ClsPub.isBool(DsSub.Tables[0].Rows[i]["HCloseType"]);
                    oSub.HEntryCloseDate = DBUtility.ClsPub.isDate(DsSub.Tables[0].Rows[i]["HEntryCloseDate"]);
                    oSub.HRemark = DsSub.Tables[0].Rows[i]["HRemark"].ToString().Trim();
                    //===================================================
                    DetailColl.Add(oSub);
                }
                sReturn = "显示单据成功!";
                return true;
            }
            catch (Exception e)
            {
                sReturn = e.Message;
                throw (e);
            }
        }
    }
}
Model/Model.csproj
@@ -300,6 +300,10 @@
    <Compile Include="信息平台\ClsOA_MeetNotifyBillSub.cs" />
    <Compile Include="信息平台\ClsOA_NewMain.cs" />
    <Compile Include="信息平台\ClsOA_NewSub.cs" />
    <Compile Include="器具管理\ClsSc_MouldLowerBillMain.cs" />
    <Compile Include="器具管理\ClsSc_MouldLowerBillSub.cs" />
    <Compile Include="器具管理\ClsSc_MouldUpperBillSub.cs" />
    <Compile Include="器具管理\ClsSc_MouldUpperBillMain.cs" />
    <Compile Include="基础资料\K3基础资料\ClsK3_Customer_Model.cs" />
    <Compile Include="基础资料\K3基础资料\ClsK3_Department_Model.cs" />
    <Compile Include="基础资料\K3基础资料\ClsK3_Employee_Model.cs" />
@@ -614,6 +618,8 @@
    <Compile Include="生产管理\设备管理\ClsGy_EquipTypeBill.cs" />
    <Compile Include="生产管理\设备管理\ClsSb_EquipConkBookBillMain.cs" />
    <Compile Include="生产管理\设备管理\ClsSb_EquipConkBookBillSub.cs" />
    <Compile Include="生产管理\设备管理\ClsGy_FixCardBillMain.cs" />
    <Compile Include="生产管理\设备管理\ClsGy_FixCardBillSub_Emp.cs" />
    <Compile Include="系统公用\ClsXt_SystemParameter_Model.cs" />
    <Compile Include="计划管理\ClsGy_MaterialTechParamBillSub.cs" />
    <Compile Include="计划管理\ClsGy_MaterialTechParamBillMain.cs" />
Model/Æ÷¾ß¹ÜÀí/ClsSc_MouldLowerBillMain.cs
New file
@@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Model
{
    public class ClsSc_MouldLowerBillMain : DBUtility.ClsXt_BaseBillMain
    {
        public Int64 HDeptID;//        int        --部门ID
        public Int64 HEmpID;//        int        --操作员
        public Int64 HMangerID;//        int        --负责人
        public int HOrgID;//        int        --组织
    }
}
Model/Æ÷¾ß¹ÜÀí/ClsSc_MouldLowerBillSub.cs
New file
@@ -0,0 +1,26 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Model
{
    public class ClsSc_MouldLowerBillSub : DBUtility.ClsXt_BaseBillMain
    {
        public Int64 HMouldID;
        public Int64 HUnitID;
        public Int64 HQty;
        public Int64 HSourceID;
        public Int64 HEquipID;
        public Int64 HICMOInterID;
        public Int64 HICMOEntryID;
        public string HICMOBillNo;
        public Int64 HProcExchInterID;
        public Int64 HProcExchEntryID;
        public string HProcExchBillNo;
        public string HScanDate;
        public string HBarCode;
        public string HMouldNumber;
    }
}
Model/Æ÷¾ß¹ÜÀí/ClsSc_MouldUpperBillMain.cs
New file
@@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Model
{
    public class ClsSc_MouldUpperBillMain : DBUtility.ClsXt_BaseBillMain
    {
        public Int64 HDeptID;//        int        --部门ID
        public Int64 HEmpID;//        int        --操作员
        public Int64 HMangerID;//        int        --负责人
        public int HOrgID;//        int        --组织
    }
}
Model/Æ÷¾ß¹ÜÀí/ClsSc_MouldUpperBillSub.cs
New file
@@ -0,0 +1,26 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Model
{
    public class ClsSc_MouldUpperBillSub : DBUtility.ClsXt_BaseBillMain
    {
        public Int64 HMouldID;
        public Int64 HUnitID;
        public Int64 HQty;
        public Int64 HSourceID;
        public Int64 HEquipID;
        public Int64 HICMOInterID;
        public Int64 HICMOEntryID;
        public string HICMOBillNo;
        public Int64 HProcExchInterID;
        public Int64 HProcExchEntryID;
        public string HProcExchBillNo;
        public string HScanDate;
        public string HBarCode;
        public string HMouldNumber;
    }
}
Model/Éú²ú¹ÜÀí/É豸¹ÜÀí/ClsGy_FixCardBillMain.cs
New file
@@ -0,0 +1,32 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Model
{
    public class ClsGy_FixCardBillMain : DBUtility.ClsXt_BaseBillMain
    {
        public string HCardNumber; //卡片编码
        public string HCardName; //资产名称
        public string HCardModel;  //资产规格
        public Int64 HMaterID; //对应物料
        public Int64 HUnitID; //计量单位
        public Int64 HCardQty;//资产数量
        public string HCardForm;//卡片来源    (手工建卡)
        public string HCard;//资产性质  ï¼ˆè‡ªæœ‰èµ„产)
        public DateTime HOutComDate;    //出厂日期
        public string HOutComNo;   //出厂编号
        public DateTime HBeginUseDate; //开始使用日期
        public Int64 HCardTypeID; //资产类别(Gy_CardType)
        public Int64 HCardStatusID; //资产状态(Gy_CardStatus)
        public Int64 HCardChangeTypeID; //变动方式(Gy_CardChangeType)
        public string HBarCode; //条形码
        public string HWorkArea; //产地
        public string HLogo;//品牌
        public Int64 HSellSupID; //供应商(Gy_Supplier)
        public Int64 HMakeSupID; //制造商 (Gy_Supplier)
        public Int64 HOrgID; //资产组织
        public Int64 HOwnerID; //货主
    }
}
Model/Éú²ú¹ÜÀí/É豸¹ÜÀí/ClsGy_FixCardBillSub_Emp.cs
New file
@@ -0,0 +1,22 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Model
{
    public class ClsGy_FixCardBillSub_Emp : DBUtility.ClsXt_BaseBillSub
    {
        public Int64 HDeptID;     //使用部门(gy_Departme nt)
        public Int64 HUseEmpID; //使用人(gy_Employee)
        public Int64 HRepairEmpID; //维护负责人(gy_Employee)
        public Int64 HCardAddr; //资产位置(Gy_CardAddress)
        public string HAddress;   //放置地点
        public DateTime HSetupDate; //安装日期
        public decimal HAvgRate;// åˆ†é…æ¯”例
        public Int64 HProjectMoneyID; //费用项目(Gy_ProjectMoney)
        public DateTime HBeginDate; //开始日期
        public DateTime HEndDate; //结束日期
    }
}
WebAPI/Controllers/MJGL/Sc_MouldUpperBillController.cs
New file
@@ -0,0 +1,1231 @@
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Http;
using WebAPI.Models;
using Newtonsoft.Json;
using Model;
using DBUtility;
namespace WebAPI.Controllers.MJGL
{
    public class Sc_MouldUpperBillController : ApiController
    {
        private json objJsonResult = new json();
        public DataSet ds = new DataSet();
        SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
        Pub_Class.ClsXt_SystemParameter oSystemParameter = new Pub_Class.ClsXt_SystemParameter();
        public DAL.ClsSc_ICMOBill BillOld = new DAL.ClsSc_ICMOBill();
        #region ä¸Šæ¨¡å• åˆ—表查询
        [Route("Sc_MouldUpperBill/Sc_MouldUpperBillList")]
        [HttpGet]
        public object Sc_MouldUpperBillList(string sWhere, string user)
        {
            try
            {
                List<object> columnNameList = new List<object>();
                //查看权限
                if (!DBUtility.ClsPub.Security_Log("Sc_MouldUpperBill_Query", 1, false, user))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "无查看权限!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                ds = oCN.RunProcReturn("select * from  h_v_Qj_Sc_MouldUpperBillList where 1=1" + sWhere + "order by hmainid desc ", "h_v_Qj_Sc_MouldUpperBillList");
                //添加列名
                foreach (DataColumn col in ds.Tables[0].Columns)
                {
                    Type dataType = col.DataType;
                    string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}";
                    columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//获取到DataColumn列对象的列名
                }
                objJsonResult.code = "1";
                objJsonResult.count = 1;
                objJsonResult.Message = "Sucess!";
                objJsonResult.data = ds.Tables[0];
                objJsonResult.list = columnNameList;
                return objJsonResult;
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "Exception!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
        #region ä¸Šæ¨¡å• æ–°å¢ž
        /// <summary>
        /// æ–°å¢žå•据-保存按钮
        ///参数:string sql。
        ///返回值:object。
        /// </summary>
        [Route("Sc_MouldUpperBill/AddSc_MouldUpperBill")]
        [HttpPost]
        public object AddSc_MouldUpperBill([FromBody] JObject sMainSub)
        {
            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 = ds.Tables[0];
            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修改 2 å¤åˆ¶
            string user = sArray[3].ToString();//用户名
            try
            {
                if (!DBUtility.ClsPub.Security_Log("Sc_MouldUpperBill_Edit", 1, false, user))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "无权限编辑!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                msg2 = "[" + msg2.ToString() + "]";
                List<ClsSc_MouldUpperBillMain> mainList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<ClsSc_MouldUpperBillMain>>(msg2);
                string HBillType = "3846";
                long HInterID = mainList[0].HInterID;//递入type得到的单据ID
                string HBillNo = mainList[0].HBillNo;//递入type得到的单据号
                DateTime HDate = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd"));//日期
                int HYear = DateTime.Now.Year;
                double HPeriod = DateTime.Now.Month;
                string HRemark = mainList[0].HRemark;//备注
                string HMaker = mainList[0].HMaker;//制单人
                int HOrgID = mainList[0].HOrgID;  //组织
                Int64 HDeptID = mainList[0].HDeptID;
                Int64 HEmpID = mainList[0].HEmpID;
                Int64 HMangerID = mainList[0].HMangerID;
                ds = oCN.RunProcReturn("select * from h_v_Qj_Sc_MouldUpperBillList where hmainid=" + HInterID + " and å•据号='" + HBillNo + "'", "h_v_Qj_Sc_MouldUpperBillList");
                if ((OperationType == 1) && ds.Tables[0].Rows.Count == 0)//新增
                {
                    //主表
                    oCN.RunProc(@"Insert Into Sc_MouldUpperBillMain
                   (HBillType,HBillStatus, HBillSubType, HInterID, HBillNo, HDate
                   , HYear, HPeriod, HRemark, HMaker, HMakeDate, HOrgID
                   , HDeptID, HEmpID, HMangerID)" +
                    " values('" + HBillType + "','1','" + HBillType + "'," + HInterID + ",'" + HBillNo + "','" + HDate + "'" +
                    "," + HYear + "," + HPeriod + ",'" + HRemark + "','" + HMaker + "',getdate()," +  HOrgID +
                    ","+ HDeptID + ","+ HEmpID + ","+ HMangerID + ") ");
                }
                else if (OperationType == 3 || ds.Tables[0].Rows.Count != 0)
                { //修改
                    oCN.RunProc("update Sc_MouldUpperBillMain  set " +
                       "HDate='" + HDate +
                       "',HYear='" + HYear + "',HPeriod='" + HPeriod + "',HRemark='" + HRemark + "',hupdater='" + HMaker +
                       "',hupdatedate=getdate(),HDeptID=" + HDeptID + ",HEmpID=" + HEmpID + ",HMangerID=" + HMangerID + " where HInterID='" + HInterID + "'");
                    //删除子表
                    oCN.RunProc("delete from Sc_MouldUpperBillSub where HInterID='" + HInterID + "'");
                }
                //保存子表
                objJsonResult = AddBillSub(msg3, HInterID, 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,string HBillNo)
        {
            List<ClsSc_MouldUpperBillSub> DetailColl = Newtonsoft.Json.JsonConvert.DeserializeObject<List<ClsSc_MouldUpperBillSub>>(msg3);
            int i = 0;
            foreach (ClsSc_MouldUpperBillSub oSub in DetailColl)
            {
                i++;
                oCN.RunProc(@"Insert Into Sc_MouldUpperBillSub
                   (HInterID, HBillNo_bak, HEntryID, HMouldID, HQty
                   , HSourceID, HICMOInterID, HICMOEntryID, HICMOBillNo)
                    values("
                     + HInterID + ",'"+ HBillNo + "'," + i + "," + oSub.HMouldID.ToString() + ",'" + oSub.HQty
                     + "'," + oSub.HSourceID.ToString() + "," + oSub.HICMOInterID.ToString() + "," + oSub.HICMOEntryID.ToString()+",'"+ oSub.HICMOBillNo.ToString() +
                     "') ");
            }
            objJsonResult.code = "1";
            objJsonResult.count = 1;
            objJsonResult.Message = null;
            objJsonResult.data = null;
            return objJsonResult;
        }
        #endregion
        #region ä¸Šæ¨¡å•删除功能
        [Route("Sc_MouldUpperBill/DeltetSc_MouldUpperBill")]
        [HttpGet]
        public object DeltetSc_MouldUpperBill(string HInterID, int HPRDORGID, string user)
        {
            //编辑权限
            if (!DBUtility.ClsPub.Security_Log("Sc_MouldUpperBill_Delete", 1, false, user))
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "无删除权限!";
                objJsonResult.data = null;
                return objJsonResult;
            }
            string[] HInterIDs = HInterID.Split(',');
            string[] HBillNos = new string[HInterIDs.Length];
            for (int i = 0; i < HInterIDs.Length; i++)
            {
                oCN.BeginTran();
                string hmainid = HInterIDs[i].Split('_')[0];
                string hsubid = HInterIDs[i].Split('_')[1];
                ds = oCN.RunProcReturn(@"select HMaker,HBillNo,HBillStatus,HChecker from Sc_MouldUpperBillMain a
                                    inner join Sc_MouldUpperBillSub b on a.HInterID = b.HInterID
                                    where a.HInterID = " + hmainid , "Sc_MouldUpperBillMain");
                if (ds.Tables[0].Rows.Count != 0)
                {
                    HBillNos[i] = ds.Tables[0].Rows[0]["HBillNo"].ToString();
                    string sReturn = "";
                    if (oSystemParameter.ShowBill(ref sReturn))
                    {
                        if (oSystemParameter.omodel.Sc_ProcessExchangeBill_DeleterAndMakerMustSame == "Y")
                        {
                            if (ds.Tables[0].Rows[0]["HMaker"].ToString() != user && (user != "admin" && user != "Admin"))
                            {
                                objJsonResult.code = "0";
                                objJsonResult.count = 0;
                                objJsonResult.Message = "单据号:" + HBillNos[i] + "只能删除本人的单据!";
                                objJsonResult.data = null;
                                oCN.RollBack();
                                return objJsonResult;
                            }
                        }
                    }
                    if (int.Parse(ds.Tables[0].Rows[0]["HBillStatus"].ToString()) > 1)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "单据号:" + HBillNos[i] + "单据当前处于不能删除状态,不能删除!";
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HChecker"].ToString()  != "")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "单据号:" + HBillNos[i] + "单据已经审核,不能删除!";
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows.Count == 1) {
                        oCN.RunProc("delete from Sc_MouldUpperBillMain where HInterID=" + hmainid);
                    }
                    oCN.RunProc("delete from Sc_MouldUpperBillSub where HInterID=" + hmainid + " and HEntryID=" + hsubid);
                    oCN.Commit();
                }
                else
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "单据未找到";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
            }
            objJsonResult.code = "1";
            objJsonResult.count = 1;
            objJsonResult.Message = "删除成功!";
            objJsonResult.data = null;
            return objJsonResult;
        }
        #endregion
        #region ä¸Šæ¨¡å•审核/反审核功能
        [Route("Sc_MouldUpperBill/CheckSc_MouldUpperBill")]
        [HttpGet]
        public object CheckSc_MouldUpperBill(string HInterID, int Type, string user)
        {
            try
            {
                //判断是否有删除权限
                if (!DBUtility.ClsPub.Security_Log("Sc_ProcessExchangeBill_Sub_Check", 1, false, user))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "无权限审核!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                if (string.IsNullOrWhiteSpace(HInterID))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "HInterID为空!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                ClsPub.CurUserName = user;
                BillOld.MvarItemKey = "Sc_MouldUpperBillMain";
                oCN.BeginTran();//开始事务
                //Type 1 å®¡æ ¸  2  åå®¡æ ¸
                if (Type == 1)
                {
                    //判断单据是否已经审核
                    DataSet ds;
                    string sql = "select * from " + BillOld.MvarItemKey + " where HinterID = " + HInterID;
                    ds = oCN.RunProcReturn(sql, BillOld.MvarItemKey);
                    if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0)
                    {
                        if (ds.Tables[0].Rows[0]["HChecker"] != null && ds.Tables[0].Rows[0]["HChecker"].ToString() != "")
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "单据已审核!不需要再审核!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                        //审核单据
                        if (!BillOld.CheckBill(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo))
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 1;
                            objJsonResult.Message = "审核失败!原因:" + ClsPub.sExeReturnInfo;
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                    }
                    else
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "单据不存在!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                }
                else
                {
                    //判断单据是否已经反审核
                    DataSet ds;
                    string sql = "select * from " + BillOld.MvarItemKey + " where HinterID = " + HInterID;
                    ds = oCN.RunProcReturn(sql, BillOld.MvarItemKey);
                    if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0)
                    {
                        if (ds.Tables[0].Rows[0]["HChecker"] == null || ds.Tables[0].Rows[0]["HChecker"].ToString() == "")
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "单据已反审核!不需要再反审核!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                        //反审核单据
                        if (BillOld.AbandonCheck(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo))
                        {
                        }
                        else
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 1;
                            objJsonResult.Message = "审核失败!原因:" + ClsPub.sExeReturnInfo;
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                    }
                    else
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "单据不存在!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                }
                oCN.Commit();//提交事务
                objJsonResult.code = "0";
                objJsonResult.count = 1;
                objJsonResult.Message = "执行成功!";
                objJsonResult.data = null;
                return objJsonResult; ;
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "执行失败!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
        #region ä¸‹æ¨¡å• åˆ—表查询
        [Route("Sc_MouldUpperBill/Sc_MouldLowerBillList")]
        [HttpGet]
        public object Sc_MouldLowerBillList(string sWhere, string user)
        {
            try
            {
                List<object> columnNameList = new List<object>();
                //查看权限
                if (!DBUtility.ClsPub.Security_Log("Sc_MouldLowerBill_Query", 1, false, user))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "无查看权限!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                ds = oCN.RunProcReturn("select * from  h_v_Qj_Sc_MouldLowerBillList where 1=1" + sWhere + "order by hmainid desc ", "h_v_Qj_Sc_MouldLowerBillList");
                //添加列名
                foreach (DataColumn col in ds.Tables[0].Columns)
                {
                    Type dataType = col.DataType;
                    string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}";
                    columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//获取到DataColumn列对象的列名
                }
                objJsonResult.code = "1";
                objJsonResult.count = 1;
                objJsonResult.Message = "Sucess!";
                objJsonResult.data = ds.Tables[0];
                objJsonResult.list = columnNameList;
                return objJsonResult;
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "Exception!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
        #region ä¸‹æ¨¡å• æ–°å¢ž
        /// <summary>
        /// æ–°å¢žå•据-保存按钮
        ///参数:string sql。
        ///返回值:object。
        /// </summary>
        [Route("Sc_MouldUpperBill/AddSc_MouldLowerBill")]
        [HttpPost]
        public object AddSc_MouldLowerBill([FromBody] JObject sMainSub)
        {
            var _value = sMainSub["sMainSub"].ToString();
            string msg1 = _value.ToString();
            oCN.BeginTran();
            //保存主表
            objJsonResult = AddMouldLowerBill(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 = ds.Tables[0];
            return objJsonResult;
        }
        public json AddMouldLowerBill(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修改 2 å¤åˆ¶
            string user = sArray[3].ToString();//用户名
            try
            {
                if (!DBUtility.ClsPub.Security_Log("Sc_MouldLowerBill_Edit", 1, false, user))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "无权限编辑!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                msg2 = "[" + msg2.ToString() + "]";
                List<ClsSc_MouldLowerBillMain> mainList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<ClsSc_MouldLowerBillMain>>(msg2);
                string HBillType = "3847";
                long HInterID = mainList[0].HInterID;//递入type得到的单据ID
                string HBillNo = mainList[0].HBillNo;//递入type得到的单据号
                DateTime HDate = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd"));//日期
                int HYear = DateTime.Now.Year;
                double HPeriod = DateTime.Now.Month;
                string HRemark = mainList[0].HRemark;//备注
                string HMaker = mainList[0].HMaker;//制单人
                int HOrgID = mainList[0].HOrgID;  //组织
                Int64 HDeptID = mainList[0].HDeptID;
                Int64 HEmpID = mainList[0].HEmpID;
                Int64 HMangerID = mainList[0].HMangerID;
                ds = oCN.RunProcReturn("select * from h_v_Qj_Sc_MouldLowerBillList where hmainid=" + HInterID + " and å•据号='" + HBillNo + "'", "h_v_Qj_Sc_MouldLowerBillList");
                if ((OperationType == 1) && ds.Tables[0].Rows.Count == 0)//新增
                {
                    //主表
                    oCN.RunProc(@"Insert Into Sc_MouldLowerBillMain
                   (HBillType,HBillStatus, HBillSubType, HInterID, HBillNo, HDate
                   , HYear, HPeriod, HRemark, HMaker, HMakeDate, HOrgID
                   , HDeptID, HEmpID, HMangerID)" +
                    " values('" + HBillType + "','1','" + HBillType + "'," + HInterID + ",'" + HBillNo + "','" + HDate + "'" +
                    "," + HYear + "," + HPeriod + ",'" + HRemark + "','" + HMaker + "',getdate()," + HOrgID +
                    "," + HDeptID + "," + HEmpID + "," + HMangerID + ") ");
                }
                else if (OperationType == 3 || ds.Tables[0].Rows.Count != 0)
                { //修改
                    oCN.RunProc("update Sc_MouldLowerBillMain  set " +
                       "HDate='" + HDate +
                       "',HYear='" + HYear + "',HPeriod='" + HPeriod + "',HRemark='" + HRemark + "',hupdater='" + HMaker +
                       "',hupdatedate=getdate(),HDeptID=" + HDeptID + ",HEmpID=" + HEmpID + ",HMangerID=" + HMangerID + " where HInterID='" + HInterID + "'");
                    //删除子表
                    oCN.RunProc("delete from Sc_MouldLowerBillSub where HInterID='" + HInterID + "'");
                }
                //保存子表
                objJsonResult = AddMouldLowerBill(msg3, HInterID, 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 AddMouldLowerBill(string msg3, long HInterID, string HBillNo)
        {
            List<ClsSc_MouldLowerBillSub> DetailColl = Newtonsoft.Json.JsonConvert.DeserializeObject<List<ClsSc_MouldLowerBillSub>>(msg3);
            int i = 0;
            foreach (ClsSc_MouldLowerBillSub oSub in DetailColl)
            {
                i++;
                oCN.RunProc(@"Insert Into Sc_MouldLowerBillSub
                   (HInterID, HBillNo_bak, HEntryID, HMouldID, HQty
                   , HSourceID, HICMOInterID, HICMOEntryID, HICMOBillNo)
                    values("
                     + HInterID + ",'" + HBillNo + "'," + i + "," + oSub.HMouldID.ToString() + ",'" + oSub.HQty
                     + "'," + oSub.HSourceID.ToString() + "," + oSub.HICMOInterID.ToString() + "," + oSub.HICMOEntryID.ToString() + ",'" + oSub.HICMOBillNo.ToString() +
                     "') ");
            }
            objJsonResult.code = "1";
            objJsonResult.count = 1;
            objJsonResult.Message = null;
            objJsonResult.data = null;
            return objJsonResult;
        }
        #endregion
        #region ä¸‹æ¨¡å•删除功能
        [Route("Sc_MouldUpperBill/DeltetSc_MouldLowerBill")]
        [HttpGet]
        public object DeltetSc_MouldLowerBill(string HInterID, int HPRDORGID, string user)
        {
            //编辑权限
            if (!DBUtility.ClsPub.Security_Log("Sc_MouldLowerBill_Delete", 1, false, user))
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "无删除权限!";
                objJsonResult.data = null;
                return objJsonResult;
            }
            string[] HInterIDs = HInterID.Split(',');
            string[] HBillNos = new string[HInterIDs.Length];
            for (int i = 0; i < HInterIDs.Length; i++)
            {
                oCN.BeginTran();
                string hmainid = HInterIDs[i].Split('_')[0];
                string hsubid = HInterIDs[i].Split('_')[1];
                ds = oCN.RunProcReturn(@"select HMaker,HBillNo,HBillStatus,HChecker from Sc_MouldLowerBillMain a
                                    inner join Sc_MouldLowerBillSub b on a.HInterID = b.HInterID
                                    where a.HInterID = " + hmainid, "Sc_MouldLowerBillMain");
                if (ds.Tables[0].Rows.Count != 0)
                {
                    HBillNos[i] = ds.Tables[0].Rows[0]["HBillNo"].ToString();
                    string sReturn = "";
                    if (oSystemParameter.ShowBill(ref sReturn))
                    {
                        if (oSystemParameter.omodel.Sc_ProcessExchangeBill_DeleterAndMakerMustSame == "Y")
                        {
                            if (ds.Tables[0].Rows[0]["HMaker"].ToString() != user && (user != "admin" && user != "Admin"))
                            {
                                objJsonResult.code = "0";
                                objJsonResult.count = 0;
                                objJsonResult.Message = "单据号:" + HBillNos[i] + "只能删除本人的单据!";
                                objJsonResult.data = null;
                                oCN.RollBack();
                                return objJsonResult;
                            }
                        }
                    }
                    if (int.Parse(ds.Tables[0].Rows[0]["HBillStatus"].ToString()) > 1)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "单据号:" + HBillNos[i] + "单据当前处于不能删除状态,不能删除!";
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HChecker"].ToString() != "")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "单据号:" + HBillNos[i] + "单据已经审核,不能删除!";
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows.Count == 1)
                    {
                        oCN.RunProc("delete from Sc_MouldLowerBillMain where HInterID=" + hmainid);
                    }
                    oCN.RunProc("delete from Sc_MouldLowerBillSub where HInterID=" + hmainid + " and HEntryID=" + hsubid);
                    oCN.Commit();
                }
                else
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "单据未找到";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
            }
            objJsonResult.code = "1";
            objJsonResult.count = 1;
            objJsonResult.Message = "删除成功!";
            objJsonResult.data = null;
            return objJsonResult;
        }
        #endregion
        #region ä¸‹æ¨¡å•审核/反审核功能
        [Route("Sc_MouldUpperBill/CheckSc_MouldLowerBill")]
        [HttpGet]
        public object CheckSc_MouldLowerBill(string HInterID, int Type, string user)
        {
            try
            {
                //判断是否有删除权限
                if (!DBUtility.ClsPub.Security_Log("Sc_ProcessExchangeBill_Sub_Check", 1, false, user))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "无权限审核!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                if (string.IsNullOrWhiteSpace(HInterID))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "HInterID为空!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                ClsPub.CurUserName = user;
                BillOld.MvarItemKey = "Sc_MouldLowerBillMain";
                oCN.BeginTran();//开始事务
                //Type 1 å®¡æ ¸  2  åå®¡æ ¸
                if (Type == 1)
                {
                    //判断单据是否已经审核
                    DataSet ds;
                    string sql = "select * from " + BillOld.MvarItemKey + " where HinterID = " + HInterID;
                    ds = oCN.RunProcReturn(sql, BillOld.MvarItemKey);
                    if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0)
                    {
                        if (ds.Tables[0].Rows[0]["HChecker"] != null && ds.Tables[0].Rows[0]["HChecker"].ToString() != "")
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "单据已审核!不需要再审核!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                        //审核单据
                        if (!BillOld.CheckBill(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo))
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 1;
                            objJsonResult.Message = "审核失败!原因:" + ClsPub.sExeReturnInfo;
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                    }
                    else {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "单据不存在!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                }
                else
                {
                    //判断单据是否已经反审核
                    DataSet ds;
                    string sql = "select * from " + BillOld.MvarItemKey + " where HinterID = " + HInterID;
                    ds = oCN.RunProcReturn(sql, BillOld.MvarItemKey);
                    if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0)
                    {
                        if (ds.Tables[0].Rows[0]["HChecker"] == null || ds.Tables[0].Rows[0]["HChecker"].ToString() == "")
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "单据已反审核!不需要再反审核!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                        //反审核单据
                        if (BillOld.AbandonCheck(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo))
                        {
                        }
                        else
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 1;
                            objJsonResult.Message = "审核失败!原因:" + ClsPub.sExeReturnInfo;
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                    }
                    else
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "单据不存在!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                }
                oCN.Commit();//提交事务
                objJsonResult.code = "0";
                objJsonResult.count = 1;
                objJsonResult.Message = "执行成功!";
                objJsonResult.data = null;
                return objJsonResult; ;
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "执行失败!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
        #region ä¸Š/下模单获取条码信息
        [Route("Sc_MouldUpperBill/txtHBarCode_KeyDown")]
        [HttpGet]
        public object txtHBarCode_KeyDown(string HBarCode, string UserID, string HBillType)
        {
            try
            {
                if (HBarCode == null || HBarCode.Equals(""))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "空白码,条形码不能为空!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                //拆分条形码
                string sBillBarCode = HBarCode.Trim();
                //截取条码类型2 å‰ä¸¤ä½
                string BillNoType2 = sBillBarCode.Substring(0, Math.Min(2, sBillBarCode.Length));
                //截取条码类型 å‰ä¸‰ä½
                string BillNoType3 = sBillBarCode.Substring(0, Math.Min(3, sBillBarCode.Length));
                //截取条码类型3 å‰å››ä½
                string BillNoType4 = sBillBarCode.Substring(0, Math.Min(4, sBillBarCode.Length));
                switch (BillNoType2)
                {
                    //生产资源
                    case "BM":
                    case "SS":
                        ds = oCN.RunProcReturn("select HItemID,HName,HNumber from Gy_Source where HNumber = '" + HBarCode + "'", "Gy_Source");
                        break;
                    case "MO":
                        ds = oCN.RunProcReturn("select å•据号,hmainid,HEntryID from h_v_IF_ICMOBillList where å•据号 = '" + HBarCode + "'", "h_v_IF_ICMOBillList");
                        break;
                    default:
                        break;
                }
                switch (BillNoType3)
                {
                    //器具档案
                    case "MJD":
                    case "PAK":
                        ds = oCN.RunProcReturn("select * from h_v_Gy_MouldFileList where å•据号 = '" + HBarCode + "'", "h_v_Gy_MouldFileList");
                        break;
                    default:
                        break;
                }
                switch (BillNoType4)
                {
                    //流转卡
                    case "GXLX":
                        ds = oCN.RunProcReturn("select ä»»åŠ¡å•å·,hicmointerid,HICMOEntryID,单据号,hmainid,HEntryID from h_v_Sc_ProcessExchangeBillQuerySub where å•据号 = '" + HBarCode + "'", "h_v_Sc_ProcessExchangeBillQuerySub");
                        break;
                    default:
                        break;
                }
                if (ds == null || ds .Tables.Count== 0 || ds.Tables[0].Rows.Count == 0)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "查无数据!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                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 ä¸Šæ¨¡å• PDA新增
        /// <summary>
        /// æ–°å¢žå•据-保存按钮
        ///参数:string sql。
        ///返回值:object。
        /// </summary>
        [Route("Sc_MouldUpperBill/AddSc_MouldUpperBill_PDA")]
        [HttpPost]
        public object AddSc_MouldUpperBill_PDA([FromBody] JObject oMain)
        {
            var _value = oMain["oMain"].ToString();
            string msg1 = _value.ToString();
            oCN.BeginTran();
            //保存主表
            objJsonResult = AddBillMain_PDA(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 = ds.Tables[0];
            return objJsonResult;
        }
        public json AddBillMain_PDA(string msg1)
        {
            string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
            string msg2 = sArray[0].ToString();
            string user = sArray[1].ToString();//用户名
            int OperationType = int.Parse(sArray[2].ToString());//数据类型 1添加 3修改 2 å¤åˆ¶
            try
            {
                if (!DBUtility.ClsPub.Security_Log("Sc_MouldUpperBill_Edit", 1, false, user))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "无权限编辑!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                msg2 = "[" + msg2.ToString() + "]";
                List<ClsSc_MouldUpperBillMain> mainList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<ClsSc_MouldUpperBillMain>>(msg2);
                string HBillType = "3846";
                long HInterID = mainList[0].HInterID;//递入type得到的单据ID
                string HBillNo = mainList[0].HBillNo;//递入type得到的单据号
                DateTime HDate = mainList[0].HDate;//日期
                int HYear = DateTime.Now.Year;
                double HPeriod = DateTime.Now.Month;
                string HRemark = mainList[0].HRemark;//备注
                string HMaker = mainList[0].HMaker;//制单人
                int HOrgID = mainList[0].HOrgID;  //组织
                Int64 HDeptID = mainList[0].HDeptID;
                Int64 HEmpID = mainList[0].HEmpID;
                Int64 HMangerID = mainList[0].HMangerID;
                ds = oCN.RunProcReturn("select * from h_v_Qj_Sc_MouldUpperBillList where hmainid=" + HInterID + " and å•据号='" + HBillNo + "'", "h_v_Qj_Sc_MouldUpperBillList");
                if ((OperationType == 1) && ds.Tables[0].Rows.Count == 0)//新增
                {
                    //主表
                    oCN.RunProc(@"Insert Into Sc_MouldUpperBillMain
                   (HBillType,HBillStatus, HBillSubType, HInterID, HBillNo, HDate
                   , HYear, HPeriod, HRemark, HMaker, HMakeDate, HOrgID
                   , HDeptID, HEmpID, HMangerID)" +
                    " values('" + HBillType + "','1','" + HBillType + "'," + HInterID + ",'" + HBillNo + "','" + HDate + "'" +
                    "," + HYear + "," + HPeriod + ",'" + HRemark + "','" + HMaker + "',getdate()," + HOrgID +
                    "," + HDeptID + "," + HEmpID + "," + HMangerID + ") ");
                }
                else if (OperationType == 3 || ds.Tables[0].Rows.Count != 0)
                { //修改
                    oCN.RunProc("update Sc_MouldUpperBillMain  set " +
                       "HDate='" + HDate +
                       "',HYear='" + HYear + "',HPeriod='" + HPeriod + "',HRemark='" + HRemark + "',hupdater='" + HMaker +
                       "',hupdatedate=getdate(),HDeptID=" + HDeptID + ",HEmpID=" + HEmpID + ",HMangerID=" + HMangerID + " where HInterID='" + HInterID + "'");
                    //删除子表
                    oCN.RunProc("delete from Sc_MouldUpperBillSub where HInterID='" + HInterID + "'");
                }
                //保存子表
                objJsonResult = AddBillSub_PDA(msg2, HInterID, 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_PDA(string msg2, long HInterID, string HBillNo)
        {
            List<ClsSc_MouldUpperBillSub> DetailColl = Newtonsoft.Json.JsonConvert.DeserializeObject<List<ClsSc_MouldUpperBillSub>>(msg2);
            int i = 0;
            foreach (ClsSc_MouldUpperBillSub oSub in DetailColl)
            {
                i++;
                oCN.RunProc(@"Insert Into Sc_MouldUpperBillSub
                   (HInterID, HBillNo_bak, HEntryID, HMouldID, HQty
                   , HSourceID, HICMOInterID, HICMOEntryID, HICMOBillNo
                    ,HProcExchBillNo,HProcExchInterID,HProcExchEntryID
                    ,HScanDate,HBarCode)
                    values("
                     + HInterID + ",'" + HBillNo + "'," + i + "," + oSub.HMouldID.ToString() + ",'" + oSub.HQty
                     + "'," + oSub.HSourceID.ToString() + "," + oSub.HICMOInterID.ToString() + "," + oSub.HICMOEntryID.ToString() + ",'" + oSub.HICMOBillNo.ToString()
                     + "','" + oSub.HProcExchBillNo.ToString() + "'," + oSub.HProcExchInterID.ToString() + "," + oSub.HProcExchEntryID.ToString()
                     + ",'" + oSub.HScanDate.ToString() + "','" + oSub.HMouldNumber.ToString() + "') ");
            }
            objJsonResult.code = "1";
            objJsonResult.count = 1;
            objJsonResult.Message = null;
            objJsonResult.data = null;
            return objJsonResult;
        }
        #endregion
        #region ä¸‹æ¨¡å• PDA新增
        /// <summary>
        /// æ–°å¢žå•据-保存按钮
        ///参数:string sql。
        ///返回值:object。
        /// </summary>
        [Route("Sc_MouldUpperBill/AddSc_MouldLowerBill_PDA")]
        [HttpPost]
        public object AddSc_MouldLowerBill_PDA([FromBody] JObject oMain)
        {
            var _value = oMain["oMain"].ToString();
            string msg1 = _value.ToString();
            oCN.BeginTran();
            //保存主表
            objJsonResult = AddSc_MouldLowerBillMain_PDA(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 = ds.Tables[0];
            return objJsonResult;
        }
        public json AddSc_MouldLowerBillMain_PDA(string msg1)
        {
            string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
            string msg2 = sArray[0].ToString();
            string user = sArray[1].ToString();//用户名
            int OperationType = int.Parse(sArray[2].ToString());//数据类型 1添加 3修改 2 å¤åˆ¶
            try
            {
                if (!DBUtility.ClsPub.Security_Log("Sc_MouldLowerBill_Edit", 1, false, user))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "无权限编辑!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                msg2 = "[" + msg2.ToString() + "]";
                List<ClsSc_MouldLowerBillMain> mainList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<ClsSc_MouldLowerBillMain>>(msg2);
                string HBillType = "3847";
                long HInterID = mainList[0].HInterID;//递入type得到的单据ID
                string HBillNo = mainList[0].HBillNo;//递入type得到的单据号
                DateTime HDate = mainList[0].HDate;//日期
                int HYear = DateTime.Now.Year;
                double HPeriod = DateTime.Now.Month;
                string HRemark = mainList[0].HRemark;//备注
                string HMaker = mainList[0].HMaker;//制单人
                int HOrgID = mainList[0].HOrgID;  //组织
                Int64 HDeptID = mainList[0].HDeptID;
                Int64 HEmpID = mainList[0].HEmpID;
                Int64 HMangerID = mainList[0].HMangerID;
                ds = oCN.RunProcReturn("select * from h_v_Qj_Sc_MouldLowerBillList where hmainid=" + HInterID + " and å•据号='" + HBillNo + "'", "h_v_Qj_Sc_MouldLowerBillList");
                if ((OperationType == 1) && ds.Tables[0].Rows.Count == 0)//新增
                {
                    //主表
                    oCN.RunProc(@"Insert Into Sc_MouldLowerBillMain
                   (HBillType,HBillStatus, HBillSubType, HInterID, HBillNo, HDate
                   , HYear, HPeriod, HRemark, HMaker, HMakeDate, HOrgID
                   , HDeptID, HEmpID, HMangerID)" +
                    " values('" + HBillType + "','1','" + HBillType + "'," + HInterID + ",'" + HBillNo + "','" + HDate + "'" +
                    "," + HYear + "," + HPeriod + ",'" + HRemark + "','" + HMaker + "',getdate()," + HOrgID +
                    "," + HDeptID + "," + HEmpID + "," + HMangerID + ") ");
                }
                else if (OperationType == 3 || ds.Tables[0].Rows.Count != 0)
                { //修改
                    oCN.RunProc("update Sc_MouldLowerBillMain  set " +
                       "HDate='" + HDate +
                       "',HYear='" + HYear + "',HPeriod='" + HPeriod + "',HRemark='" + HRemark + "',hupdater='" + HMaker +
                       "',hupdatedate=getdate(),HDeptID=" + HDeptID + ",HEmpID=" + HEmpID + ",HMangerID=" + HMangerID + " where HInterID='" + HInterID + "'");
                    //删除子表
                    oCN.RunProc("delete from Sc_MouldLowerBillSub where HInterID='" + HInterID + "'");
                }
                //保存子表
                objJsonResult = AddSc_MouldLowerBillSub_PDA(msg2, HInterID, 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 AddSc_MouldLowerBillSub_PDA(string msg2, long HInterID, string HBillNo)
        {
            List<ClsSc_MouldLowerBillSub> DetailColl = Newtonsoft.Json.JsonConvert.DeserializeObject<List<ClsSc_MouldLowerBillSub>>(msg2);
            int i = 0;
            foreach (ClsSc_MouldLowerBillSub oSub in DetailColl)
            {
                i++;
                oCN.RunProc(@"Insert Into Sc_MouldLowerBillSub
                   (HInterID, HBillNo_bak, HEntryID, HMouldID, HQty
                   , HSourceID, HICMOInterID, HICMOEntryID, HICMOBillNo
                    ,HProcExchBillNo,HProcExchInterID,HProcExchEntryID
                    ,HScanDate,HBarCode)
                    values("
                     + HInterID + ",'" + HBillNo + "'," + i + "," + oSub.HMouldID.ToString() + ",'" + oSub.HQty
                     + "'," + oSub.HSourceID.ToString() + "," + oSub.HICMOInterID.ToString() + "," + oSub.HICMOEntryID.ToString() + ",'" + oSub.HICMOBillNo.ToString()
                     + "','" + oSub.HProcExchBillNo.ToString() + "'," + oSub.HProcExchInterID.ToString() + "," + oSub.HProcExchEntryID.ToString()
                     + ",'" + oSub.HScanDate.ToString() + "','" + oSub.HMouldNumber.ToString() + "') ");
            }
            objJsonResult.code = "1";
            objJsonResult.count = 1;
            objJsonResult.Message = null;
            objJsonResult.data = null;
            return objJsonResult;
        }
        #endregion
    }
}
WebAPI/Controllers/SBGL/Gy_FixCardBillController.cs
New file
@@ -0,0 +1,542 @@
using DBUtility;
using Newtonsoft.Json;
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 Gy_FixCardBillController : ApiController
    {
        //获取系统参数
        Pub_Class.ClsXt_SystemParameter oSystemParameter = new Pub_Class.ClsXt_SystemParameter();
        public DBUtility.ClsPub.Enum_BillStatus BillStatus;
        private json objJsonResult = new json();
        SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
        DataSet ds;
        public DAL.ClsGy_FixCardBill BillOld = new DAL.ClsGy_FixCardBill();
        #region å›ºå®šèµ„产卡片列表查询
        [Route("Gy_FixCardBill/list")]
        [HttpGet]
        public object list(string sWhere, string user)
        {
            try
            {
                List<object> columnNameList = new List<object>();
                //编辑权限
                if (!DBUtility.ClsPub.Security_Log_second("Gy_FixCardBill_Query", 1, false, user))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "无查看权限!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                string sql1 = string.Format(@"select * from h_v_Gy_FixCardBillList where 1 = 1");
                if (sWhere == null || sWhere.Equals(""))
                {
                    ds = oCN.RunProcReturn(sql1 + sWhere , "h_v_Gy_FixCardBillList");
                }
                else
                {
                    string sql = sql1 + sWhere;
                    ds = oCN.RunProcReturn(sql, "h_v_Gy_FixCardBillList");
                }
                //添加列名
                foreach (DataColumn col in ds.Tables[0].Columns)
                {
                    Type dataType = col.DataType;
                    string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}";
                    columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//获取到DataColumn列对象的列名
                }
                objJsonResult.code = "1";
                objJsonResult.count = 1;
                objJsonResult.Message = "Sucess!";
                objJsonResult.data = ds.Tables[0];
                objJsonResult.list = columnNameList;
                return objJsonResult;
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "Exception!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
        #region å›ºå®šèµ„产卡片 ä¿å­˜/编辑
        [Route("Gy_FixCardBill/SaveFixCardBillList")]
        [HttpPost]
        public object SaveFixCardBillList([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 OperationType = sArray[3].ToString(); //操作类型
            string UserName = "";
            ListModels oListModels = new ListModels();
            try
            {
                if (!DBUtility.ClsPub.Security_Log("Gy_FixCardBill_Edit", 1, false, msg4))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "无保存权限!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                DAL.ClsGy_FixCardBill oBill = new DAL.ClsGy_FixCardBill();
                List<Model.ClsGy_FixCardBillMain> lsmain = new List<Model.ClsGy_FixCardBillMain>();
                msg2 = msg2.Replace("\\", "");
                msg2 = msg2.Replace("\n", "");  //\n
                lsmain = oListModels.getObjectByJson_Gy_FixCardBillMain(msg2);
                foreach (Model.ClsGy_FixCardBillMain oItem in lsmain)
                {
                    //oItem.HMaker = "";
                    UserName = oItem.HMaker;  //制单人
                    oItem.HBillType = "3335";
                    oItem.HBillSubType = "3335";
                    oItem.HDate = DBUtility.ClsPub.isDate(DateTime.Now.ToString("yyyy-MM-dd"));//  --日期
                    oItem.HYear = DBUtility.ClsPub.isLong(DateTime.Now.Year);
                    oItem.HPeriod = DBUtility.ClsPub.isLong(DateTime.Now.Month);
                    oItem.HBillStatus = 1;
                    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.ClsGy_FixCardBillSub_Emp> ls = new List<Model.ClsGy_FixCardBillSub_Emp>();
                ls = oListModels.getObjectByJson_Gy_FixCardBillSub_Emp(msg3);
                int i = 0;
                foreach (Model.ClsGy_FixCardBillSub_Emp oItemSub in ls)
                {
                    i++;
                    oItemSub.HEntryID = i;
                    oBill.DetailColl.Add(oItemSub);
                }
                //保存
                //保存完毕后处理
                bool bResult;
                if (OperationType == "1")
                {
                    bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo);
                }
                else
                {
                    bResult = oBill.ModifyBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo);
                }
                if (bResult)
                {
                    objJsonResult.code = "1";
                    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("Gy_FixCardBill/DelFixCardBill")]
        [HttpGet]
        public object DelFixCardBill(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.ClsGy_FixCardBill oBill = new DAL.ClsGy_FixCardBill();
            if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo))
            {
                ds = oCN.RunProcReturn("select * from Gy_FixCardBillMain where HInterID=" + lngBillKey, "Gy_FixCardBillMain");
                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;
                }
                //删除前控制=========================================
                string HBillNo = ds.Tables[0].Rows[0]["HBillNo"].ToString();
                string sql1 = "exec h_p_Gy_FixCardBill_BeforeDelCtrl " + HInterID + ",'" + HBillNo + "','" + user + "'";
                ds = oCN.RunProcReturn(sql1, "h_p_Gy_FixCardBill_BeforeDelCtrl");
                if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "删除失败!原因:删除前判断失败,请与网络管理人员联系";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "删除失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                //==================================================================================
                bool IsDete = oBill.DeleteBill(lngBillKey, HBillNo, "h_p_Gy_FixCardBill_AfterDelCtrl", user, ref DBUtility.ClsPub.sExeReturnInfo);
                if (IsDete)
                {
                    objJsonResult.code = "1";
                    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
        #region å›ºå®šèµ„产卡片 å®¡æ ¸/反审核功能
        [Route("Gy_FixCardBill/CheckGy_FixCardBill")]
        [HttpGet]
        public object CheckGy_FixCardBill(string HInterID, int Type, string user)
        {
            try
            {
                //判断是否有删除权限
                if (!DBUtility.ClsPub.Security_Log("Gy_FixCardBill_Check", 1, false, user))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "无权限审核!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                if (string.IsNullOrWhiteSpace(HInterID))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "HInterID为空!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                ClsPub.CurUserName = user;
                BillOld.MvarItemKey = "Gy_FixCardBillMain";
                oCN.BeginTran();//开始事务
                //Type 1 å®¡æ ¸  2  åå®¡æ ¸
                if (Type == 1)
                {
                    //判断单据是否已经审核
                    DataSet ds;
                    string sql = "select * from " + BillOld.MvarItemKey + " where HinterID = " + HInterID;
                    ds = oCN.RunProcReturn(sql, BillOld.MvarItemKey);
                    if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0)
                    {
                        if (ds.Tables[0].Rows[0]["HChecker"] != null && ds.Tables[0].Rows[0]["HChecker"].ToString() != "")
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "单据已审核!不需要再审核!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                    }
                    //审核前控制
                    string HBillNo = ds.Tables[0].Rows[0]["HBillNo"].ToString();
                    sql = "exec h_p_Gy_FixCardBill_BeforeCheckCtrl " + int.Parse(HInterID) + ",'" + HBillNo + "','" + user + "'";
                    ds = oCN.RunProcReturn(sql, "h_p_Gy_FixCardBill_BeforeCheckCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "审核失败!原因:审核前判断失败,请与网络管理人员联系";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //审核单据
                    if (!BillOld.CheckBill(Int64.Parse(HInterID), HBillNo, "h_p_Gy_FixCardBill_AfterCheckCtrl", user, ref ClsPub.sExeReturnInfo))
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "审核失败!原因:" + ClsPub.sExeReturnInfo;
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                }
                else
                {
                    //判断单据是否已经反审核
                    DataSet ds;
                    string sql = "select * from " + BillOld.MvarItemKey + " where HinterID = " + HInterID;
                    ds = oCN.RunProcReturn(sql, BillOld.MvarItemKey);
                    if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0)
                    {
                        if (ds.Tables[0].Rows[0]["HChecker"] == null || ds.Tables[0].Rows[0]["HChecker"].ToString() == "")
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "单据已反审核!不需要再反审核!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                    }
                    //反审核前控制
                    string HBillNo = ds.Tables[0].Rows[0]["HBillNo"].ToString();
                    sql = "exec h_p_Gy_FixCardBill_BeforeUnCheckCtrl " + int.Parse(HInterID) + ",'" + HBillNo + "','" + user + "'";
                    ds = oCN.RunProcReturn(sql, "h_p_Gy_FixCardBill_BeforeUnCheckCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反审核失败!原因:反审核前判断失败,请与网络管理人员联系";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //反审核单据
                    if (BillOld.AbandonCheck(Int64.Parse(HInterID), HBillNo, "h_p_Gy_FixCardBill_AfterUnCheckCtrl", user, ref ClsPub.sExeReturnInfo))
                    {
                    }
                    else
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "审核失败!原因:" + ClsPub.sExeReturnInfo;
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                }
                oCN.Commit();//提交事务
                objJsonResult.code = "0";
                objJsonResult.count = 1;
                objJsonResult.Message = "执行成功!";
                objJsonResult.data = null;
                return objJsonResult; ;
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "执行失败!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
        #region å›ºå®šèµ„产 å…³é—­/反关闭功能
        [Route("Gy_FixCardBill/CloseGy_FixCardBill")]
        [HttpGet]
        public object CloseGy_FixCardBill(string HInterID, int Type, string user)
        {
            try
            {
                //判断是否有删除权限
                if (!DBUtility.ClsPub.Security_Log("Gy_FixCardBill_Close", 1, false, user))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "无权限关闭!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                if (string.IsNullOrWhiteSpace(HInterID))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "HInterID为空!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                ClsPub.CurUserName = user;
                BillOld.MvarItemKey = "Gy_FixCardBillMain";
                oCN.BeginTran();//开始事务
                //Type 1 å…³é—­  2  åå…³é—­
                if (Type == 1)
                {
                    //判断单据是否已经关闭
                    DataSet ds;
                    string sql = "select * from " + BillOld.MvarItemKey + " where HinterID = " + HInterID;
                    ds = oCN.RunProcReturn(sql, BillOld.MvarItemKey);
                    if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0)
                    {
                        if (ds.Tables[0].Rows[0]["HCloseMan"] != null && ds.Tables[0].Rows[0]["HCloseMan"].ToString() != "")
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "单据已关闭!不需要再关闭!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                    }
                    //关闭单据
                    if (!BillOld.CloseBill(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo))
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "关闭失败!原因:" + ClsPub.sExeReturnInfo;
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                }
                else
                {
                    //判断单据是否已经反关闭
                    DataSet ds;
                    string sql = "select * from " + BillOld.MvarItemKey + " where HinterID = " + HInterID;
                    ds = oCN.RunProcReturn(sql, BillOld.MvarItemKey);
                    if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0)
                    {
                        if (ds.Tables[0].Rows[0]["HCloseMan"] == null || ds.Tables[0].Rows[0]["HCloseMan"].ToString() == "")
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "单据已反关闭!不需要再反关闭!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                    }
                    //反关闭单据
                    if (!BillOld.CancelClose(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo))
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反关闭失败!原因:" + ClsPub.sExeReturnInfo;
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                }
                oCN.Commit();//提交事务
                objJsonResult.code = "0";
                objJsonResult.count = 1;
                objJsonResult.Message = "执行成功!";
                objJsonResult.data = null;
                return objJsonResult; ;
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "执行失败!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
    }
}
WebAPI/Controllers/XSGL/Xs_OutDoorCheckBillController.cs
@@ -590,7 +590,45 @@
        #endregion
        //---------------------------------------------------------------PDA模块调用
        #region å‡ºé—¨ç¡®è®¤å•列表
        /// <summary>
        /// èŽ·å–å‡ºé—¨ç¡®è®¤å•åˆ—è¡¨ä¿¡æ¯
        /// </summary>
        /// <returns></returns>
        [Route("Xs_OutDoorCheckBillController/GetXs_OutDoorCheckBillList_PDA_Json")]
        [HttpGet]
        public object GetXs_OutDoorCheckBillList_PDA_Json(string sWhere)
        {
            try
            {
                //返回列表信息
                ds = oCn.RunProcReturn("exec h_p_Xs_OutDoorCheckBillList_PDA '" + sWhere + "'", "h_p_Xs_OutDoorCheckBillList_PDA");
                List<object> columnNameList = new List<object>();
                //添加列名
                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 = "0";
                objJsonResult.count = 1;
                objJsonResult.Message = "成功!";
                objJsonResult.data = ds.Tables[0];
                objJsonResult.list = columnNameList;
                return objJsonResult;
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "查询列表信息失败!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
    }
}
WebAPI/DLL/ClsSc_ICMOReportBill.cs
@@ -105,8 +105,8 @@
                    //反写产量汇报单,质量汇报单关联字段,生产订单关联数量
                    Ds = oCn.RunProcReturn("exec h_p_Sc_ICMOReportBill_ReverseWriteQty " + omodel.HInterID + "," + oSub.HEntryID + ",'" + omodel.HBillNo + "'," +
                        DetailColl[0].HICMOInterID + "," + DetailColl[0].HICMOEntryID + "," + DetailColl[0].HICMOBillNo + ",'" + DetailColl[0].HSourceID + "','" +
                        "Edit" + "'," + HBackQty
                        DetailColl[0].HICMOInterID + "," + DetailColl[0].HICMOEntryID + ",'" + DetailColl[0].HICMOBillNo + "','" + DetailColl[0].HSourceID + "','" +
                        "Edit" + "'," + HBackQty + "," + DetailColl[0].HICMOTempID
                        , "h_p_Sc_ICMOReportBill_ReverseWriteQty");
                    if (DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBack"]) == "1")
                    {
@@ -262,7 +262,7 @@
                    //反写产量汇报单,质量汇报单关联字段,生产订单关联数量
                    ds = oCn.RunProcReturn("exec h_p_Sc_ICMOReportBill_ReverseWriteQty " + omodel.HInterID + "," + oSub.HEntryID + ",'" + omodel.HBillNo + "'," +
                        DetailColl[0].HICMOInterID + "," + DetailColl[0].HICMOEntryID + ",'" + DetailColl[0].HICMOBillNo + "','" + DetailColl[0].HSourceID + "','" +
                        "Add" + "'," + 0+","+ DetailColl[0].HICMOTempID
                        "Add" + "'," + 0 + "," + DetailColl[0].HICMOTempID
                        , "h_p_Sc_ICMOReportBill_ReverseWriteQty");
                    if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) == "1")
                    {
WebAPI/ListModels.cs
@@ -3201,6 +3201,31 @@
            return list;
        }
        /// <summary>
        /// å›ºå®šèµ„产卡片 ä¸»è¡¨
        /// </summary>
        /// <param name="jsonString"></param>
        /// <returns></returns>
        // ClsGy_FixCardBillMain
        public List<Model.ClsGy_FixCardBillMain> getObjectByJson_Gy_FixCardBillMain(string jsonString)
        {
            jsonString = "[" + jsonString.ToString() + "]";
            List<Model.ClsGy_FixCardBillMain> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsGy_FixCardBillMain>>(jsonString);
            return list;
        }
        /// <summary>
        /// å›ºå®šèµ„产卡片 å­è¡¨
        /// </summary>
        /// <param name="jsonString"></param>
        /// <returns></returns>
        // ClsGy_FixCardBillSub_Emp
        public List<Model.ClsGy_FixCardBillSub_Emp> getObjectByJson_Gy_FixCardBillSub_Emp(string jsonString)
        {
            jsonString = "[" + jsonString.ToString() + "]";
            List<Model.ClsGy_FixCardBillSub_Emp> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsGy_FixCardBillSub_Emp>>(jsonString);
            return list;
        }
        #region å®¢è¯‰å¤„理单
        /// <summary>
        /// å®¢è¯‰å¤„理单主表json
WebAPI/WebAPI.csproj
@@ -415,7 +415,9 @@
    <Compile Include="Controllers\MJGL\Sc_MouldLifeUseBillController.cs" />
    <Compile Include="Controllers\MJGL\Sc_MouldScrapRequestBillController.cs" />
    <Compile Include="Controllers\MJGL\Sc_MouldStatusChangeBillController.cs" />
    <Compile Include="Controllers\MJGL\Sc_MouldUpperBillController.cs" />
    <Compile Include="Controllers\Pay_ReportController.cs" />
    <Compile Include="Controllers\SBGL\Gy_FixCardBillController.cs" />
    <Compile Include="Controllers\SBGL\Sb_EquipConkBookBillController.cs" />
    <Compile Include="Controllers\SBGL\Sb_EquipSparepartsBillController.cs" />
    <Compile Include="Controllers\SBGL\Sb_EquipSparepartsChangeBillController.cs" />
@@ -1079,6 +1081,7 @@
    <Folder Include="Views\Sc_MouldRepairSendWorkBill\" />
    <Folder Include="Views\Sc_MouldScrapRequestBill\" />
    <Folder Include="Views\Sc_MouldStatusChangeBill\" />
    <Folder Include="Views\Sc_MouldUpperBill\" />
    <Folder Include="Views\Sc_ProcessExchangeIssueBill\" />
    <Folder Include="Views\Sc_ProcessSendWork\" />
    <Folder Include="Views\Sc_ProcExchRecordBackBill\" />