yusijie
2026-01-14 ab221ac319d80616f6dde22bb99d2123678b9d73
WebAPI/Controllers/ÎïÁ÷¹ÜÀí/³öÔ˵¥/WLYayBillController.cs
@@ -93,10 +93,10 @@
                }
                ListMaterial = ListMaterial.Replace(';', ',');
                List<object> columnNameList = new List<object>();
                    ds = oCN.RunProcReturn("select a.*,b.HUnitID from h_v_Gy_MaterialPackingRelationList_Edit a left JOIN Gy_Material b on a.HMaterID=b.HItemID where HDefaultSendPackFlag=1 and  HMaterID in (" + ListMaterial+")", "h_v_Gy_MaterialPackingRelationList");
                ds = oCN.RunProcReturn("select a.*,b.HUnitID from h_v_Gy_MaterialPackingRelationList_Edit a left JOIN Gy_Material b on a.HMaterID=b.HItemID where HDefaultSendPackFlag=1 and å®¡æ ¸äºº='' and  HMaterID in (" + ListMaterial + ")", "h_v_Gy_MaterialPackingRelationList");
                //添加列名
@@ -375,16 +375,23 @@
                }
                var ds = oCN.RunProcReturn("select * from WL_YayBillMain where HInterID=" + HInterID, "WL_YayBillMain");
                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;
                }
                oCN.BeginTran();
                    oCN.RunProc("update WL_YayBillMain set HDate_CarrierSure='" + DateTime.Now.ToString("yyyy-MM-dd") + "' where HInterID=" + HInterID);
                oCN.RunProc("update WL_YayBillMain set HDate_CarrierSure='" + DateTime.Now.ToString("yyyy-MM-dd") + "' where HInterID=" + HInterID);
                    objJsonResult.code = "1";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "成功";
                    objJsonResult.data = null;
                objJsonResult.code = "1";
                objJsonResult.count = 1;
                objJsonResult.Message = "成功";
                objJsonResult.data = null;
                oCN.Commit();
                return objJsonResult;
@@ -429,22 +436,54 @@
                var ds = oCN.RunProcReturn("select * from WL_YayBillMain where HInterID=" + HInterID, "WL_YayBillMain");
                oCN.BeginTran();
                if(IsAudit== 1)
                if (IsAudit == 1)
                {
                    if (ds.Tables[0].Rows[0]["HDate_AllocationDriver"] == null || ds.Tables[0].Rows[0]["HDate_AllocationDriver"].ToString() == "")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "请先分配司机!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    oCN.RunProc("update WL_YayBillMain set HSurer_Arrive='" + CurUserName + "',HDate_Arrive=getdate()  where HInterID=" + HInterID);
                }
                else if(IsAudit == 2)
                else if (IsAudit == 2)
                {
                    if (ds.Tables[0].Rows[0]["HSurer_Arrive"] == null)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "请先到厂确认!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    oCN.RunProc("update WL_YayBillMain set HSurer_Pick='" + CurUserName + "',HDate_Pick=getdate()  where HInterID=" + HInterID);
                }
                else if(IsAudit == 3)
                else if (IsAudit == 3)
                {
                    if (ds.Tables[0].Rows[0]["HSurer_Pick"] == null || ds.Tables[0].Rows[0]["HSurer_Pick"].ToString() == "")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "请先提货确认!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    oCN.RunProc("update WL_YayBillMain set HSurer_Trans='" + CurUserName + "',HDate_Trans=getdate()  where HInterID=" + HInterID);
                }
                else if(IsAudit == 4)
                else if (IsAudit == 4)
                {
                    if (ds.Tables[0].Rows[0]["HSurer_Trans"] == null || ds.Tables[0].Rows[0]["HSurer_Trans"].ToString() == "")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "请先出厂运输确认!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    oCN.RunProc("update WL_YayBillMain set HSurer_Receive='" + CurUserName + "',HDate_Receive=getdate()  where HInterID=" + HInterID);
                }
@@ -484,14 +523,25 @@
        /// <returns></returns>
        [Route("WLYayBillController/selectDriver")]
        [HttpGet]
        public object selectDriver(int HInterID,int HcheckID, int IsAudit, string CurUserName)
        public object selectDriver(int HInterID, int HcheckID, int IsAudit, string CurUserName)
        {
            try
            {
                DataSet ds;
                if(IsAudit==1)
                var dss = oCN.RunProcReturn("select * from WL_YayBillMain where HInterID=" + HInterID, "WL_YayBillMain");
                if (dss.Tables[0].Rows[0]["HDate_CarrierSure"] == null || dss.Tables[0].Rows[0]["HDate_CarrierSure"].ToString() == "")
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "请先供应商确认!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                if (IsAudit == 1)
                {
                    ds = oCN.RunProcReturn("select * from h_v_Gy_CarList where HItemID=" + HcheckID, "h_v_Gy_CarList");
                    if (ds.Tables[0].Rows.Count > 0)
                    {
                        oCN.BeginTran();
@@ -507,7 +557,7 @@
                        return objJsonResult;
                    }
                }
                else
                {
@@ -547,5 +597,32 @@
            }
        }
        #endregion
        [Route("WLYayBillController/updateBillMEs")]
        [HttpGet]
        public object updateBillMEs(int HInterID,int HEntryID, int ScatteredVolume, string CurUserName)
        {
            var ds = oCN.RunProcReturn("select * from WL_YayBillMain a inner join WL_YayBillSub_Material b on b.HInterID=a.HInterID where a.HInterID=" + HInterID, "WL_YayBillMain");
            if (ds != null || ds.Tables[0].Rows.Count <= 0)
            {
                oCN.BeginTran();
                oCN.RunProc("update WL_YayBillSub_Material set HScatteredVolume= " + ScatteredVolume + " where HInterID=" + HInterID+ "and HEntryID="+ HEntryID);
                objJsonResult.code = "1";
                objJsonResult.count = 1;
                objJsonResult.Message = "成功";
                objJsonResult.data = null;
                oCN.Commit();
                return objJsonResult;
            }
            else
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "更新失败!";
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
    }
}