yxj
2023-07-04 6b2c7a19f95349edd1de84e3a2d857403abc6e1b
WebAPI/Controllers/Éú²ú¹ÜÀí/Éú²úÈÎÎñµ¥/Sc_ICMOBillController.cs
@@ -9,6 +9,7 @@
using System.Data;
using System.Data.SqlClient;
using System.Web.Http;
using System.Windows.Forms;
using WebAPI.Models;
namespace WebAPI.Controllers
@@ -307,7 +308,7 @@
                 values({oSub.HInterID},{oSub.HEntryID},{(oSub.HQty == null ? 0 : oSub.HQty)}
                ,'{(oSub.HPlanBeginDate == null ? DateTime.Now.ToString("yyyy-MM-dd") : oSub.HPlanBeginDate.ToString())}','{(oSub.HPlanEndDate == null ? DateTime.Now.AddDays(1).ToString("yyyy-MM-dd") : oSub.HPlanEndDate.ToString())}'
                ,'{(oSub.HPlanBeginDate == null ? DateTime.Now.ToString("yyyy-MM-dd") : oSub.HPlanBeginDate.ToString())}','{(oSub.HPlanEndDate == null ? DateTime.Now.AddDays(1).ToString("yyyy-MM-dd") : oSub.HPlanEndDate.ToString())}'
                ,{oSub.HMaterID},{oSub.HUnitID},'{oSub.HRemark}',{oSub.HSourceID},{oSub.HDeptID},4
                ,{oSub.HMaterID},{oSub.HUnitID},'{oSub.HRemark}',{oSub.HSourceID},{oSub.HDeptID},'{oSub.HSTATUS}'
                       ,0,0,'','',0,0
                ,{oSub.HCOSTRATE},{oSub.HISBACKFLUSH},'{oSub.HBatchNo}',{oSub.HBomID},{oSub.HCHECKPRODUCT},{oSub.HSEQ},{oSub.HSTOCKINORGID})");
                }
@@ -412,6 +413,7 @@
            int OperationType = int.Parse(sArray[1].ToString()); // æ•°æ®ç±»åž‹ 1添加 3修改
            string user = sArray[2].ToString();
            int HEntryID = int.Parse(sArray[3].ToString());
            string HComputerName = SystemInformation.ComputerName; //设备名称
            try
            {
@@ -461,6 +463,10 @@
                    ",'" + HSeOrderBillNo + "'," + HSeOrderInterID + "," + HSeOrderEntryID + "," + HEmpID + "," + HCusID +
                    "," + HCenterID + ",0,0,0,0," + HBomID + ",'',''" +
                    ",'"+ HIsStockQty + "','"+ HRemark3 + "') ");
                    LogService.Write("用户:" + user + ",日期:" + DateTime.Now + ",新增生产订单单据:" + HBillNo);
                    oCN.RunProc("Insert into System_log (GeginDate, userid, WorkstationName, WorkList, SystemName, NetuserName, State) select GETDATE(),'" + user + "','" + HComputerName + "','" + "新增生产订单单据:" + HBillNo + "','LMES-生产订单模块','" + DBUtility.ClsPub.IPAddress + "','新增单据'", ref DBUtility.ClsPub.sExeReturnInfo);
                }
                else if (OperationType == 3 || ds.Tables[0].Rows.Count != 0)
                {
@@ -481,6 +487,9 @@
                    //删除子表
                    oCN.RunProc("delete from Sc_ICMOBillSub where HInterID='" + HInterID + "' and HEntryID='" + HEntryID + "'");
                    LogService.Write("用户:" + user + ",日期:" + DateTime.Now + ",修改生产订单单据:" + HBillNo);
                    oCN.RunProc("Insert into System_log (GeginDate, userid, WorkstationName, WorkList, SystemName, NetuserName, State) select GETDATE(),'" + user + "','" + HComputerName + "','" + "修改生产订单单据:" + HBillNo + "','LMES-生产订单模块','" + DBUtility.ClsPub.IPAddress + "','修改单据'", ref DBUtility.ClsPub.sExeReturnInfo);
                }
                //保存子表
                objJsonResult = AddBillSub_NoTable(msg3, HInterID, OperationType, HEntryID);
@@ -820,6 +829,8 @@
        {
            try
            {
                string HComputerName = SystemInformation.ComputerName; //设备名称
                //判断是否有删除权限
                if (!DBUtility.ClsPub.Security_Log("Sc_ICMOBill_Drop", 1, false, user))
                {
@@ -865,8 +876,6 @@
                    }
                }
                if (int.Parse(ds.Tables[0].Rows[0]["HBillStatus"].ToString()) > 1)
                {
                    objJsonResult.code = "0";
@@ -876,8 +885,47 @@
                    return objJsonResult; ;
                }
               var DataSet = oCN.RunProcReturn("select * from Sc_ProcessExchangeBillMain where HICMOBillNo='" + ds.Tables[0].Rows[0]["HBillNo"].ToString() +"'", "Sc_ProcessExchangeBillMain");
                if (DataSet.Tables[0].Rows.Count > 0)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "单据已下推工序流转卡,不允许删除!";
                    objJsonResult.data = null;
                    return objJsonResult; ;
                }
                 DataSet = oCN.RunProcReturn("select * from h_v_IF_ProductInBillList where æºå•单号='" + ds.Tables[0].Rows[0]["HBillNo"].ToString() + "'", "h_v_IF_ProductInBillList");
                if (DataSet.Tables[0].Rows.Count > 0)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "单据已下推生产入库单,不允许删除!";
                    objJsonResult.data = null;
                    return objJsonResult; ;
                }
                DataSet = oCN.RunProcReturn("select * from h_v_IF_MateOutBillList where æºå•单号='" + ds.Tables[0].Rows[0]["HBillNo"].ToString() + "'", "h_v_IF_MateOutBillList");
                if (DataSet.Tables[0].Rows.Count > 0)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "单据已下推生产领料单,不允许删除!";
                    objJsonResult.data = null;
                    return objJsonResult; ;
                }
                oCN.RunProc("delete from Sc_ICMOBillMain  where HInterID=" + HInterID);
                oCN.RunProc("delete from Sc_ICMOBillSub  where HInterID=" + HInterID);
                LogService.Write("用户:" + user + ",日期:" + DateTime.Now + ",删除生产订单单据:" + ds.Tables[0].Rows[0]["HBillNo"].ToString());
                oCN.RunProc("Insert into System_log (GeginDate, userid, WorkstationName, WorkList, SystemName, NetuserName, State) select GETDATE(),'" + user + "','" + HComputerName + "','" + "删除生产订单单据:" + ds.Tables[0].Rows[0]["HBillNo"].ToString() + "','LMES-生产订单模块','" + DBUtility.ClsPub.IPAddress + "','删除单据'", ref DBUtility.ClsPub.sExeReturnInfo);
                oCN.Commit();//提交事务
                objJsonResult.code = "0";
                objJsonResult.count = 1;