From d1763a58e75722a3e3dedfe4e59fcfc9f8fd586a Mon Sep 17 00:00:00 2001
From: zrg <z18737863051@163.com>
Date: 星期五, 15 三月 2024 15:52:38 +0800
Subject: [PATCH] Merge branch 'master' of http://101.37.171.70:10101/r/MES-WEB-API

---
 WebAPI/Controllers/MJGL/Sc_MouldUpperBillController.cs   | 1231 ++++++++++++++++++++++++++++++++
 Model/Model.csproj                                       |    6 
 WebAPI/Controllers/SBGL/Gy_FixCardBillController.cs      |  542 ++++++++++++++
 WebAPI/Controllers/XSGL/Xs_OutDoorCheckBillController.cs |   40 +
 Model/器具管理/ClsSc_MouldUpperBillMain.cs                   |   16 
 WebAPI/ListModels.cs                                     |   25 
 Model/生产管理/设备管理/ClsGy_FixCardBillSub_Emp.cs              |   22 
 DAL/DAL.csproj                                           |    1 
 DAL/生产管理/设备管理/ClsGy_FixCardBill.cs                       |  239 ++++++
 Model/器具管理/ClsSc_MouldLowerBillSub.cs                    |   26 
 Model/器具管理/ClsSc_MouldUpperBillSub.cs                    |   26 
 Model/生产管理/设备管理/ClsGy_FixCardBillMain.cs                 |   32 
 WebAPI/DLL/ClsSc_ICMOReportBill.cs                       |    6 
 WebAPI/WebAPI.csproj                                     |    3 
 Model/器具管理/ClsSc_MouldLowerBillMain.cs                   |   16 
 15 files changed, 2,227 insertions(+), 4 deletions(-)

diff --git a/DAL/DAL.csproj b/DAL/DAL.csproj
index 0c12f82..95d6b9d 100644
--- a/DAL/DAL.csproj
+++ b/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" />
diff --git "a/DAL/\347\224\237\344\272\247\347\256\241\347\220\206/\350\256\276\345\244\207\347\256\241\347\220\206/ClsGy_FixCardBill.cs" "b/DAL/\347\224\237\344\272\247\347\256\241\347\220\206/\350\256\276\345\244\207\347\256\241\347\220\206/ClsGy_FixCardBill.cs"
new file mode 100644
index 0000000..b4551bc
--- /dev/null
+++ "b/DAL/\347\224\237\344\272\247\347\256\241\347\220\206/\350\256\276\345\244\207\347\256\241\347\220\206/ClsGy_FixCardBill.cs"
@@ -0,0 +1,239 @@
+锘縰sing 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 鍥哄畾浠g爜
+
+        ~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);
+                //鑻AINDI閲嶅鍒欓噸鏂拌幏鍙�
+                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);
+            }
+        }
+       
+        
+    }
+
+}
diff --git a/Model/Model.csproj b/Model/Model.csproj
index 8d4cc92..0d15f58 100644
--- a/Model/Model.csproj
+++ b/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" />
diff --git "a/Model/\345\231\250\345\205\267\347\256\241\347\220\206/ClsSc_MouldLowerBillMain.cs" "b/Model/\345\231\250\345\205\267\347\256\241\347\220\206/ClsSc_MouldLowerBillMain.cs"
new file mode 100644
index 0000000..bbddaf8
--- /dev/null
+++ "b/Model/\345\231\250\345\205\267\347\256\241\347\220\206/ClsSc_MouldLowerBillMain.cs"
@@ -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		--组织
+        
+    }
+}
diff --git "a/Model/\345\231\250\345\205\267\347\256\241\347\220\206/ClsSc_MouldLowerBillSub.cs" "b/Model/\345\231\250\345\205\267\347\256\241\347\220\206/ClsSc_MouldLowerBillSub.cs"
new file mode 100644
index 0000000..63604d1
--- /dev/null
+++ "b/Model/\345\231\250\345\205\267\347\256\241\347\220\206/ClsSc_MouldLowerBillSub.cs"
@@ -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;
+
+    }
+}
diff --git "a/Model/\345\231\250\345\205\267\347\256\241\347\220\206/ClsSc_MouldUpperBillMain.cs" "b/Model/\345\231\250\345\205\267\347\256\241\347\220\206/ClsSc_MouldUpperBillMain.cs"
new file mode 100644
index 0000000..89dd80a
--- /dev/null
+++ "b/Model/\345\231\250\345\205\267\347\256\241\347\220\206/ClsSc_MouldUpperBillMain.cs"
@@ -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		--组织
+        
+    }
+}
diff --git "a/Model/\345\231\250\345\205\267\347\256\241\347\220\206/ClsSc_MouldUpperBillSub.cs" "b/Model/\345\231\250\345\205\267\347\256\241\347\220\206/ClsSc_MouldUpperBillSub.cs"
new file mode 100644
index 0000000..c7de990
--- /dev/null
+++ "b/Model/\345\231\250\345\205\267\347\256\241\347\220\206/ClsSc_MouldUpperBillSub.cs"
@@ -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;
+
+    }
+}
diff --git "a/Model/\347\224\237\344\272\247\347\256\241\347\220\206/\350\256\276\345\244\207\347\256\241\347\220\206/ClsGy_FixCardBillMain.cs" "b/Model/\347\224\237\344\272\247\347\256\241\347\220\206/\350\256\276\345\244\207\347\256\241\347\220\206/ClsGy_FixCardBillMain.cs"
new file mode 100644
index 0000000..02cc6f8
--- /dev/null
+++ "b/Model/\347\224\237\344\272\247\347\256\241\347\220\206/\350\256\276\345\244\207\347\256\241\347\220\206/ClsGy_FixCardBillMain.cs"
@@ -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; //货主
+
+    }
+}
diff --git "a/Model/\347\224\237\344\272\247\347\256\241\347\220\206/\350\256\276\345\244\207\347\256\241\347\220\206/ClsGy_FixCardBillSub_Emp.cs" "b/Model/\347\224\237\344\272\247\347\256\241\347\220\206/\350\256\276\345\244\207\347\256\241\347\220\206/ClsGy_FixCardBillSub_Emp.cs"
new file mode 100644
index 0000000..d71bbd7
--- /dev/null
+++ "b/Model/\347\224\237\344\272\247\347\256\241\347\220\206/\350\256\276\345\244\207\347\256\241\347\220\206/ClsGy_FixCardBillSub_Emp.cs"
@@ -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; //结束日期
+
+    }
+}
diff --git a/WebAPI/Controllers/MJGL/Sc_MouldUpperBillController.cs b/WebAPI/Controllers/MJGL/Sc_MouldUpperBillController.cs
new file mode 100644
index 0000000..9ba9e13
--- /dev/null
+++ b/WebAPI/Controllers/MJGL/Sc_MouldUpperBillController.cs
@@ -0,0 +1,1231 @@
+锘縰sing 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));//鑾峰彇鍒癉ataColumn鍒楀璞$殑鍒楀悕
+                }
+
+                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>
+        /// 鏂板鍗曟嵁-淇濆瓨鎸夐挳
+        ///鍙傛暟锛歴tring 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寰楀埌鐨勫崟鎹甀D
+                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));//鑾峰彇鍒癉ataColumn鍒楀璞$殑鍒楀悕
+                }
+
+                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>
+        /// 鏂板鍗曟嵁-淇濆瓨鎸夐挳
+        ///鍙傛暟锛歴tring 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寰楀埌鐨勫崟鎹甀D
+                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)
+                {
+                    //鍣ㄥ叿妗f
+                    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>
+        /// 鏂板鍗曟嵁-淇濆瓨鎸夐挳
+        ///鍙傛暟锛歴tring 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寰楀埌鐨勫崟鎹甀D
+                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>
+        /// 鏂板鍗曟嵁-淇濆瓨鎸夐挳
+        ///鍙傛暟锛歴tring 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寰楀埌鐨勫崟鎹甀D
+                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
+    }
+}
\ No newline at end of file
diff --git a/WebAPI/Controllers/SBGL/Gy_FixCardBillController.cs b/WebAPI/Controllers/SBGL/Gy_FixCardBillController.cs
new file mode 100644
index 0000000..b5f6656
--- /dev/null
+++ b/WebAPI/Controllers/SBGL/Gy_FixCardBillController.cs
@@ -0,0 +1,542 @@
+锘縰sing 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));//鑾峰彇鍒癉ataColumn鍒楀璞$殑鍒楀悕
+                }
+
+                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
+
+    }
+}
diff --git a/WebAPI/Controllers/XSGL/Xs_OutDoorCheckBillController.cs b/WebAPI/Controllers/XSGL/Xs_OutDoorCheckBillController.cs
index cbd9129..4772373 100644
--- a/WebAPI/Controllers/XSGL/Xs_OutDoorCheckBillController.cs
+++ b/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));  //鑾峰彇鍒癉ataColumn鍒楀璞$殑鍒楀悕
+                }
+                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
 
     }
 }
\ No newline at end of file
diff --git a/WebAPI/DLL/ClsSc_ICMOReportBill.cs b/WebAPI/DLL/ClsSc_ICMOReportBill.cs
index edacf54..345fc26 100644
--- a/WebAPI/DLL/ClsSc_ICMOReportBill.cs
+++ b/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")
                     {
diff --git a/WebAPI/ListModels.cs b/WebAPI/ListModels.cs
index 12b697e..0e8695a 100644
--- a/WebAPI/ListModels.cs
+++ b/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>
         /// 瀹㈣瘔澶勭悊鍗曚富琛╦son
diff --git a/WebAPI/WebAPI.csproj b/WebAPI/WebAPI.csproj
index 74da0de..3ce7888 100644
--- a/WebAPI/WebAPI.csproj
+++ b/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\" />

--
Gitblit v1.9.1