From 8488b6537bb110165c951771cd50da337432c5a2 Mon Sep 17 00:00:00 2001
From: yangle <admin@YINMOU>
Date: 星期四, 21 四月 2022 21:07:04 +0800
Subject: [PATCH] 日计划编辑

---
 WebAPI/Controllers/SCGL/Cg_PODemandPlanBillController.cs |  181 ++++++++++++++++
 WebAPI/Models/Sc_WorkBillSortBillSub.cs                  |   30 ++
 WebAPI/WebAPI.csproj                                     |    6 
 WebAPI/Controllers/SCGL/Sc_WorkBillSortBillController.cs |  330 ++++++++++++++++++++++++++++++
 WebAPI/Models/Sc_WorkBillSortBillMain.cs                 |   71 ++++++
 5 files changed, 618 insertions(+), 0 deletions(-)

diff --git a/WebAPI/Controllers/SCGL/Cg_PODemandPlanBillController.cs b/WebAPI/Controllers/SCGL/Cg_PODemandPlanBillController.cs
new file mode 100644
index 0000000..4f7d441
--- /dev/null
+++ b/WebAPI/Controllers/SCGL/Cg_PODemandPlanBillController.cs
@@ -0,0 +1,181 @@
+锘縰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;
+
+namespace WebAPI.Controllers.SCGL
+{
+    public class Cg_PODemandPlanBillController : ApiController
+    {
+        private json objJsonResult = new json();
+        public DataSet ds = new DataSet();
+        public WebServer webserver = new WebServer();
+        SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
+
+        #region 鎻愭枡璁″垝鍗� 鍒楄〃
+        [Route("Cg_PODemandPlanBill/Cg_PODemandPlanBillList")]
+        [HttpGet]
+        public object Cg_PODemandPlanBillList(string sWhere, string user)
+        {
+            try
+            {
+                //鏌ョ湅鏉冮檺
+                if (!DBUtility.ClsPub.Security_Log("Cg_PODemandPlanBill_Query", 1, false, user))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鏃犳煡鐪嬫潈闄愶紒";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                ds = oCN.RunProcReturn("select * from  h_v_JIT_Cg_PODemandPlanBillList where 1=1" + sWhere+ "order by hmainid desc ", "h_v_JIT_Cg_PODemandPlanBillList");
+
+                objJsonResult.code = "1";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "Sucess锛�";
+                objJsonResult.data = ds.Tables[0];
+                return objJsonResult;
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "Exception锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
+        #region 鎻愭枡璁″垝鍗� 鍒犻櫎
+        [Route("Cg_PODemandPlanBill/DelPODemandPlanBillList")]
+        [HttpGet]
+        public object DelPODemandPlanBillList(string HInterID, string HEntryID, string User)
+        {
+            try
+            {
+                //鍒犻櫎鏉冮檺
+                if (!DBUtility.ClsPub.Security_Log_second("Cg_PODemandPlanBill_Drop", 1, false, User))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鏃犳潈闄愬垹闄わ紒";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                ds = oCN.RunProcReturn("select * from h_v_JIT_Cg_PODemandPlanBillList where 1=1 and hmainid=" + HInterID, "h_v_JIT_Cg_PODemandPlanBillList");
+
+                if (ds.Tables[0].Rows.Count > 0)
+                {
+                    if (ds.Tables[0].Rows[0]["鍗曟嵁鐘舵��"].ToString() != "1")
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "褰撳墠鍗曟嵁涓嶈兘鍒犻櫎锛�";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+
+                    oCN.BeginTran();//寮�鍚簨鍔�
+
+                    if (ds.Tables[0].Rows.Count == 1)
+                    {
+                        oCN.RunProc($"delete from Cg_PODemandPlanBillMain where HInterID={HInterID}");
+                    }
+                    oCN.RunProc($"delete from Cg_PODemandPlanBillSub where HInterID={HInterID} and HEntryID={HEntryID}");
+
+                    oCN.Commit();//缁撴潫浜嬪姟
+
+                    objJsonResult.code = "1";
+                    objJsonResult.count = 1;
+                    objJsonResult.Message = "鍒犻櫎鎴愬姛锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "褰撳墠鍗曟嵁涓嶅瓨鍦�,鏃犳硶鍒犻櫎锛�";
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+            catch (Exception e)
+            {
+                oCN.RollBack();//鍥炴粴浜嬪姟
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
+        #region 鎻愭枡璁″垝鍗� 鍏抽棴
+        [Route("Cg_PODemandPlanBill/ClosePODemandPlanBillList")]
+        [HttpGet]
+        public object ClosePODemandPlanBillList(string HInterID, string User)
+        {
+            try
+            {
+                //鍏抽棴鏉冮檺
+                if (!DBUtility.ClsPub.Security_Log_second("Cg_PODemandPlanBill_Close", 1, false, User))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鏃犳潈闄愬叧闂紒";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                ds = oCN.RunProcReturn("select * from h_v_JIT_Cg_PODemandPlanBillList where 1=1 and hmainid=" + HInterID, "h_v_JIT_Cg_PODemandPlanBillList");
+
+                if (ds.Tables[0].Rows.Count > 0)
+                {
+                    if (ds.Tables[0].Rows[0]["鍗曟嵁鐘舵��"].ToString() == "2")
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "褰撳墠鍗曟嵁姝e湪瀹℃牳,涓嶈兘鍏抽棴锛�";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+
+                    oCN.BeginTran();//寮�鍚簨鍔�
+
+                    oCN.RunProc($"update Cg_PODemandPlanBillMain set HBillStatus=3,HCloseMan='{User}',HCloseDate=getdate()   where HInterID={HInterID}");
+
+                    oCN.Commit();//缁撴潫浜嬪姟
+
+                    objJsonResult.code = "1";
+                    objJsonResult.count = 1;
+                    objJsonResult.Message = "鍏抽棴鎴愬姛锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "褰撳墠鍗曟嵁涓嶅瓨鍦�,鏃犳硶鍏抽棴锛�";
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+            catch (Exception e)
+            {
+                oCN.RollBack();//鍥炴粴浜嬪姟
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+    }
+}
\ No newline at end of file
diff --git a/WebAPI/Controllers/SCGL/Sc_WorkBillSortBillController.cs b/WebAPI/Controllers/SCGL/Sc_WorkBillSortBillController.cs
new file mode 100644
index 0000000..c04e494
--- /dev/null
+++ b/WebAPI/Controllers/SCGL/Sc_WorkBillSortBillController.cs
@@ -0,0 +1,330 @@
+锘縰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;
+
+namespace WebAPI.Controllers.SCGL
+{
+    public class Sc_WorkBillSortBillController : ApiController
+    {
+        private json objJsonResult = new json();
+        public DataSet ds = new DataSet();
+        public WebServer webserver = new WebServer();
+        SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
+        Sc_WorkBillSortBillMain omdelMian = new Sc_WorkBillSortBillMain();
+        List<Sc_WorkBillSortBillSub> omodelsub = new List<Sc_WorkBillSortBillSub>();
+
+        #region 鏃ヨ鍒掑伐鍗� 鍒楄〃
+        [Route("Sc_WorkBillSortBill/Sc_WorkBillSortBillList")]
+        [HttpGet]
+        public object Sc_WorkBillSortBillList(string sWhere, string user)
+        {
+            try
+            {
+                //鏌ョ湅鏉冮檺
+                if (!DBUtility.ClsPub.Security_Log("Sc_WorkBillSortBill_Query", 1, false, user))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鏃犳煡鐪嬫潈闄愶紒";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                ds = oCN.RunProcReturn("select * from  h_v_JIT_Sc_WorkBillSortBillList where 1=1" + sWhere + "order by hmainid desc ", "h_v_JIT_Sc_WorkBillSortBillList");
+
+                objJsonResult.code = "1";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "Sucess锛�";
+                objJsonResult.data = ds.Tables[0];
+                return objJsonResult;
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "Exception锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
+        #region 鏃ヨ鍒掑伐鍗�  娣诲姞/淇敼
+        [Route("Sc_WorkBillSortBill/AddWorkBillSortBillList")]
+        [HttpPost]
+        public object AddWorkBillSortBillList([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 = null;
+            return objJsonResult;
+        }
+
+        public json AddBillMain(string msg1)
+        {
+            string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
+            string msg2 = sArray[0].ToString();
+            string msg3 = sArray[1].ToString();
+
+            int hentryid = int.Parse(sArray[2].ToString());//瀛愯〃鐨勯『搴廼d
+            int OperationType = int.Parse(sArray[3].ToString());//鏁版嵁绫诲瀷 1娣诲姞 3淇敼
+            string user = sArray[4].ToString();
+            try
+            {
+                if (!DBUtility.ClsPub.Security_Log("JIT_ComplementGoodBill_Edit", 1, false, user))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鏃犱繚瀛樻潈闄愶紒";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                omdelMian = Newtonsoft.Json.JsonConvert.DeserializeObject<Sc_WorkBillSortBillMain>(msg2);
+                string BillType = "4610";
+
+
+                if (OperationType == 1)//鏂板
+                {
+                    //涓昏〃
+                    oCN.RunProc("insert into Sc_WorkBillSortBillMain(HInterID,HBillNo,HYear,HPeriod,HBillType" +
+                                 ",HBillSubType,HDate,HBillStatus,HMaker,HMakeDate" +
+                                 ", HRemark, HPrintQty, HDeptID, HSeOrderBillNo, HSourceQty" +
+                                 ", HInStockQty, HMaterID, HMaterName, HMaterModel, HGroupID" +
+                                 ", HWorkShopID, HRelationQty, HUnitID, HWorkerID, HSourceID" +
+                                 ", HBeginWorkTimes, HInStockOwnerTypeID, HSplitRelationQty, HOrderLev, HWorkQty" +
+                                 ", HSplitPlanQty, HOwnerTypeID, HPlanBeginDate, HPlanEndDate, HICMOBillNo" +
+                                 ", HOwnerID, HBatchNo, HYX, HProdTimes, HEntrustORGID" +
+                                 ", HPlanQty, HPreparatDate, HOrderNeedQty, HOrderCommitDate, HCompleteQty" +
+                                 ", HSeOrderBillQty, HICMOInterID, HKTQ, HStockInORGID, HDayPlanSumQty" +
+                                 ", HSourceBillNo, HICMOEntryID, HMainInterID, HProdORGID, HLeftPlanQty" +
+                                 ", HEmpID, HInStockOwnerID, HICMOEntrySEQ, HICMOBillType, HCloseCount" +
+                                 ", HOrderType, HSplitQty, HSourceStockInQty, HPriority, HLocked, HHangUp)" +
+                                $"values({omdelMian.HInterID}, '{omdelMian.HBillNo}', {DateTime.Now.Year}, {DateTime.Now.Month}, '{BillType}'" +
+                                $", '{BillType}','{omdelMian.HDate}',1, '{omdelMian.HMaker}',GETDATE()," +
+                                $"'{omdelMian.HRemark}',{(omdelMian.HPrintQty==null?0: omdelMian.HPrintQty)},{omdelMian.HDeptID}, '{omdelMian.HSeOrderBillNo}', {(omdelMian.HSourceQty==null?0:omdelMian.HSourceQty)}" +
+                                $",{(omdelMian.HInStockQty == null ? 0: omdelMian.HInStockQty)},{omdelMian.HMaterID}, '{omdelMian.HMaterName}', '{omdelMian.HMaterModel}', {omdelMian.HGroupID}" +
+                                $", {omdelMian.HWorkShopID}, {(omdelMian.HRelationQty == null ? 0: omdelMian.HRelationQty)},{omdelMian.HUnitID},{omdelMian.HWorkerID},{omdelMian.HSourceID}" +
+                                $", {(omdelMian.HBeginWorkTimes == null ? 0: omdelMian.HBeginWorkTimes)}, '{omdelMian.HInStockOwnerTypeID}', {(omdelMian.HSplitRelationQty == null ? 0:omdelMian.HSplitRelationQty)}, '{omdelMian.HOrderLev}', {(omdelMian.HWorkQty == null ? 0:omdelMian.HWorkQty)}" +
+                                $", {(omdelMian.HSplitPlanQty == null ? 0: omdelMian.HSplitPlanQty)}, '{omdelMian.HOwnerTypeID}', '{omdelMian.HPlanBeginDate}','{omdelMian.HPlanEndDate}', '{omdelMian.HICMOBillNo}'" +
+                                $", {omdelMian.HOwnerID}, '{omdelMian.HBatchNo}', {(omdelMian.HYX == null ? 0: omdelMian.HYX)}, {(omdelMian.HProdTimes == null ? 0: omdelMian.HProdTimes)}, {omdelMian.HEntrustORGID}" +
+                                $", {(omdelMian.HPlanQty == null ? 0: omdelMian.HPlanQty)},'{omdelMian.HPreparatDate}', {(omdelMian.HOrderNeedQty == null ? 0: omdelMian.HOrderNeedQty)},'{omdelMian.HOrderCommitDate}', {(omdelMian.HCompleteQty == null ? 0: omdelMian.HCompleteQty)}" +
+                                $", {(omdelMian.HSeOrderBillQty == null ? 0: omdelMian.HSeOrderBillQty)},{(omdelMian.HICMOInterID == null ? 0: omdelMian.HICMOInterID)},{(omdelMian.HKTQ == null ? 0: omdelMian.HKTQ)},{(omdelMian.HStockInORGID == null ? 0: omdelMian.HStockInORGID)},{(omdelMian.HDayPlanSumQty == null ? 0: omdelMian.HDayPlanSumQty)}," +
+                                $"'{omdelMian.HSourceBillNo}', {(omdelMian.HICMOEntryID == null ? 0: omdelMian.HICMOEntryID)}, {(omdelMian.HMainInterID == null ? 0: omdelMian.HMainInterID)},{omdelMian.HProdORGID},{(omdelMian.HLeftPlanQty == null ? 0: omdelMian.HLeftPlanQty)}" +
+                                $", {(omdelMian.HEmpID == null ? 0: omdelMian.HEmpID)},{omdelMian.HInStockOwnerID},{(omdelMian.HICMOEntrySEQ == null ? 0: omdelMian.HICMOEntrySEQ)}, '{omdelMian.HICMOBillType}', {(omdelMian.HCloseCount == null ? 0: omdelMian.HCloseCount)}" +
+                                $", '{omdelMian.HOrderType}', {(omdelMian.HSplitQty == null ? 0: omdelMian.HSplitQty)}, {(omdelMian.HSourceStockInQty == null ? 0: omdelMian.HSourceStockInQty)}, {(omdelMian.HPriority == null ? 0: omdelMian.HPriority)}, '{(omdelMian.HLocked == true ? 1 : 0)}', '{(omdelMian.HHangUp == true ? 1 : 0)}')");
+                }
+                else if (OperationType == 3)
+                {
+                    //淇敼
+                    oCN.RunProc("UpDate Gy_WorkWarehouseBillMain set  " +
+                " HOrgId='" + omdelMian.HPRDORGID + "'" +
+                ",HUpDater='" + omdelMian.HMaker + "'" +
+                ",HUpDateDate='" + DateTime.Now + "'" +
+                " where HInterID=" + omdelMian.HInterID.ToString());
+
+                    //鍒犻櫎瀛愯〃
+                    oCN.RunProc("delete from Gy_WorkWarehouseBillMainSub where HInterID='" + omdelMian.HInterID.ToString() + "' and HEntryID='" + hentryid + "'");
+                }
+                //淇濆瓨瀛愯〃
+                objJsonResult = AddBillSub(msg3, hentryid);
+                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, int hentryid)
+        {
+            omodelsub = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Sc_WorkBillSortBillSub>>(msg3);
+            int i = 1;
+            //鎻掑叆瀛愯〃
+            foreach (Models.Sc_WorkBillSortBillSub oSub in omodelsub)
+            {
+                oCN.RunProc("insert into Sc_WorkBillSortBillSub(HInterID,HEntryID,HRemark,HMasterDate,HQty" +
+                            ", HRptFinishQty, HTimes, HUseTimes, HBTimes, HETimes" +
+                            ", HDateSub, HCloseMan, HEntryCloseDate, HCloseTypeSub, HColumn" +
+                            ", HLockedSub, HComplete, HStatusTag, HIsHandModify)" +
+                            $"values({omdelMian.HInterID}, {(hentryid == -1 ? i : hentryid)}, '{oSub.HRemark}', '{oSub.HMasterDate}', {(oSub.HQty == null ? 0: oSub.HQty)}" +
+                            $", {(oSub.HRptFinishQty == null ? 0: oSub.HRptFinishQty)}, {(oSub.HTimes == null ? 0: oSub.HTimes)}, {(oSub.HUseTimes == null ? 0: oSub.HUseTimes)}, '{oSub.HBTimes}', '{oSub.HETimes}'" +
+                            $", '{oSub.HDateSub}', '{oSub.HCloseMan}', '{oSub.HEntryCloseDate}', {(oSub.HCloseTypeSub == true ? 1 : 0)}, '{oSub.HColumn}'" +
+                            $", '{(oSub.HLockedSub == true ? 1 : 0)}', '{oSub.HComplete}', '{(oSub.HStatusTag == true ? 1 : 0)}', '{(oSub.HIsHandModify == true ? 1 : 0)}')");
+                i++;
+            }
+
+            objJsonResult.code = "1";
+            objJsonResult.count = 1;
+            objJsonResult.Message = null;
+            objJsonResult.data = null;
+            return objJsonResult;
+        }
+
+        #endregion
+
+        #region 鏃ヨ鍒掑伐鍗� 鍒犻櫎
+        [Route("Sc_WorkBillSortBill/DelWorkBillSortBillList")]
+        [HttpGet]
+        public object DelWorkBillSortBillList(string HInterID, string HEntryID, string User)
+        {
+            try
+            {
+                //鍒犻櫎鏉冮檺
+                if (!DBUtility.ClsPub.Security_Log_second("Sc_WorkBillSortBill_Drop", 1, false, User))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鏃犳潈闄愬垹闄わ紒";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                ds = oCN.RunProcReturn("select * from h_v_JIT_Sc_WorkBillSortBillList where 1=1 and hmainid=" + HInterID, "h_v_JIT_Sc_WorkBillSortBillList");
+
+                if (ds.Tables[0].Rows.Count > 0)
+                {
+                    if (ds.Tables[0].Rows[0]["鍗曟嵁鐘舵��"].ToString() != "1")
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "褰撳墠鍗曟嵁涓嶈兘鍒犻櫎锛�";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+
+                    oCN.BeginTran();//寮�鍚簨鍔�
+
+                    if (ds.Tables[0].Rows.Count == 1)
+                    {
+                        oCN.RunProc($"delete from Sc_WorkBillSortBillMain where HInterID={HInterID}");
+                    }
+                    oCN.RunProc($"delete from Sc_WorkBillSortBillSub where HInterID={HInterID} and HEntryID={HEntryID}");
+
+                    oCN.Commit();//缁撴潫浜嬪姟
+
+                    objJsonResult.code = "1";
+                    objJsonResult.count = 1;
+                    objJsonResult.Message = "鍒犻櫎鎴愬姛锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "褰撳墠鍗曟嵁涓嶅瓨鍦�,鏃犳硶鍒犻櫎锛�";
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+            catch (Exception e)
+            {
+                oCN.RollBack();//鍥炴粴浜嬪姟
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
+        #region 鏃ヨ鍒掑伐鍗� 鍏抽棴
+        [Route("Sc_WorkBillSortBill/CloseWorkBillSortBillList")]
+        [HttpGet]
+        public object CloseWorkBillSortBillList(string HInterID, string User)
+        {
+            try
+            {
+                //鍏抽棴鏉冮檺
+                if (!DBUtility.ClsPub.Security_Log_second("Sc_WorkBillSortBill_Close", 1, false, User))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鏃犳潈闄愬叧闂紒";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                ds = oCN.RunProcReturn("select * from h_v_JIT_Sc_WorkBillSortBillList where 1=1 and hmainid=" + HInterID, "h_v_JIT_Sc_WorkBillSortBillList");
+
+                if (ds.Tables[0].Rows.Count > 0)
+                {
+                    if (ds.Tables[0].Rows[0]["鍗曟嵁鐘舵��"].ToString() == "2")
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "褰撳墠鍗曟嵁姝e湪瀹℃牳,涓嶈兘鍏抽棴锛�";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+
+                    oCN.BeginTran();//寮�鍚簨鍔�
+
+                    oCN.RunProc($"update Sc_WorkBillSortBillMain set HBillStatus=3,HCloseMan='{User}',HCloseDate=getdate()   where HInterID={HInterID}");
+
+                    oCN.Commit();//缁撴潫浜嬪姟
+
+                    objJsonResult.code = "1";
+                    objJsonResult.count = 1;
+                    objJsonResult.Message = "鍏抽棴鎴愬姛锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "褰撳墠鍗曟嵁涓嶅瓨鍦�,鏃犳硶鍏抽棴锛�";
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+            catch (Exception e)
+            {
+                oCN.RollBack();//鍥炴粴浜嬪姟
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+    }
+}
\ No newline at end of file
diff --git a/WebAPI/Models/Sc_WorkBillSortBillMain.cs b/WebAPI/Models/Sc_WorkBillSortBillMain.cs
new file mode 100644
index 0000000..d1e307c
--- /dev/null
+++ b/WebAPI/Models/Sc_WorkBillSortBillMain.cs
@@ -0,0 +1,71 @@
+锘縰sing DBUtility;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Web;
+
+namespace WebAPI.Models
+{
+    public class Sc_WorkBillSortBillMain: ClsXt_BaseBillMain
+    {
+        public string HDocumentStatus { get; set; }
+        public bool HHangUp;
+        public string HSourceBillNo { get; set; }
+        public string HInStockOwnerTypeID { get; set; }
+        public string HOwnerTypeID { get; set; }
+        public int? HDeptID;
+        public int? HMaterID;
+        public int? HSourceID;
+        public int? HUnitID;
+        public int? HInStockOwnerID;
+        public int? HOwnerID;
+        public int? HYX;
+        public DateTime HPlanBeginDate;
+        public DateTime HPlanEndDate;
+        public DateTime HOrderCommitDate;
+        public DateTime HPreparatDate;
+        public double? HPlanQty;
+        public double? HCompleteQty;
+        public double? HInStockQty;
+        public double? HRelationQty;
+        public double? HBeginWorkTimes;
+        public double? HOrderNeedQty;
+        public double? HKTQ;
+        public double? HWorkQty;
+        public double? HSourceQty;
+        public double? HSplitPlanQty;
+        public double? HLeftPlanQty;
+        public double? HDayPlanSumQty;
+        public double? HSeOrderBillQty;
+        public string HSeOrderBillNo { get; set; }
+        public int? HGroupID;
+        public int? HWorkerID;
+        public int? HWorkShopID;
+        public int? HProdORGID;
+        public int? HEntrustORGID;
+        public int? HStockInORGID;
+        public int? HMainInterID;
+        public int? HICMOInterID;
+        public int? HICMOEntryID;
+        public int? HICMOEntrySEQ;
+        public int? HEmpID;
+        public int? HPrintQty;
+        public int? HPriority;
+        public double? HSplitRelationQty;
+        public double? HProdTimes;
+        public double? HCloseCount;
+        public double? HSplitQty;
+        public double? HSourceStockInQty;
+        public bool HLocked;
+        public string HOrderLev { get; set; }
+        public string HICMOBillNo { get; set; }
+        public string HBatchNo { get; set; }
+        public string HMaterName { get; set; }
+        public string HMaterModel { get; set; }
+        public string HICMOBillType { get; set; }
+        public string HICMOInterID_Sec { get; set; }
+        public string HICMOEntryID_Sec { get; set; }
+        public string HOrderType { get; set; }
+        public string HMonthPlanFlag { get; set; }
+    }
+}
\ No newline at end of file
diff --git a/WebAPI/Models/Sc_WorkBillSortBillSub.cs b/WebAPI/Models/Sc_WorkBillSortBillSub.cs
new file mode 100644
index 0000000..300299e
--- /dev/null
+++ b/WebAPI/Models/Sc_WorkBillSortBillSub.cs
@@ -0,0 +1,30 @@
+锘縰sing DBUtility;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Web;
+
+namespace WebAPI.Models
+{
+    public class Sc_WorkBillSortBillSub: ClsXt_BaseBillSub
+    {
+        public DateTime? HMasterDate=DateTime.Parse("1900-01-01 00:00:00.000");
+        public DateTime? HDateSub = DateTime.Parse("1900-01-01 00:00:00.000");
+        public DateTime? HBTimes = DateTime.Parse("1900-01-01 00:00:00.000");
+        public DateTime? HETimes = DateTime.Parse("1900-01-01 00:00:00.000");
+        public double? HQty;
+        public double? HTimes;
+        public double? HUseTimes;
+        public double? HProductQty;
+        public double? HUnProductQty;
+        public double? HReservedCount;
+        public double? HRptFinishQty;
+        public string HColumn { get; set; }
+        public string HComplete { get; set; }
+        public string HDayPlanPPBomBillNo { get; set; }
+        public bool HCloseTypeSub;
+        public bool HStatusTag;
+        public bool HLockedSub;
+        public bool HIsHandModify;
+    }
+}
\ No newline at end of file
diff --git a/WebAPI/WebAPI.csproj b/WebAPI/WebAPI.csproj
index a82e8da..d202e5e 100644
--- a/WebAPI/WebAPI.csproj
+++ b/WebAPI/WebAPI.csproj
@@ -359,11 +359,13 @@
     <Compile Include="Controllers\CJGL\Cj_StationInBillController.cs" />
     <Compile Include="Controllers\CJGL\Cj_StationEntrustOutBillController.cs" />
     <Compile Include="Controllers\CJGL\Sc_WorkBillAutoSortBillMainController.cs" />
+    <Compile Include="Controllers\SCGL\Cg_PODemandPlanBillController.cs" />
     <Compile Include="Controllers\SCGL\Sc_CallGoodsBackRequestBillController.cs" />
     <Compile Include="Controllers\SCGL\Sc_ComplementGoodBillController.cs" />
     <Compile Include="Controllers\SCGL\Sc_ComplementGoodsController.cs" />
     <Compile Include="Controllers\SCGL\Sc_ICBomBillController.cs" />
     <Compile Include="Controllers\SCGL\Sc_JIT_ComplementGoodBillController.cs" />
+    <Compile Include="Controllers\SCGL\Sc_WorkBillSortBillController.cs" />
     <Compile Include="Controllers\Sc_PckSplitBillController.cs" />
     <Compile Include="Controllers\GZGL\Gy_DuSubsidyItemBillController.cs" />
     <Compile Include="Controllers\GZGL\Gy_WorkPayTypeBillController.cs" />
@@ -539,6 +541,8 @@
     <Compile Include="Models\JIT_NeedMaterPlanConfigBillSub.cs" />
     <Compile Include="Models\jsonScanline.cs" />
     <Compile Include="Models\ScanLineCode.cs" />
+    <Compile Include="Models\Sc_WorkBillSortBillMain.cs" />
+    <Compile Include="Models\Sc_WorkBillSortBillSub.cs" />
     <Compile Include="Models\宸ヨ祫绠$悊\ClsGy_ClassTimePrj_Model.cs" />
     <Compile Include="Models\宸ヨ祫绠$悊\ClsPay_GroupBalBillEmp.cs" />
     <Compile Include="Models\宸ヨ祫绠$悊\ClsPay_GroupBalBillMain.cs" />
@@ -785,6 +789,7 @@
   <ItemGroup>
     <Folder Include="App_Data\" />
     <Folder Include="obj\x86\Debug\" />
+    <Folder Include="Views\Cg_PODemandPlanBill\" />
     <Folder Include="Views\Cg_PurchaseReturn\" />
     <Folder Include="Views\Cj_CallGoodsBillBack\" />
     <Folder Include="Views\Cj_CallGoodsBillMain\" />
@@ -811,6 +816,7 @@
     <Folder Include="Views\Sc_MouldRepairOutBill\" />
     <Folder Include="Views\Sc_MouldRepairSendWorkBill\" />
     <Folder Include="Views\Sc_WorkBillAutoSortBillMain\" />
+    <Folder Include="Views\Sc_WorkBillSortBill\" />
   </ItemGroup>
   <ItemGroup>
     <WCFMetadata Include="Service References\" />

--
Gitblit v1.9.1