1
wtt
21 小时以前 409529b1a6e7478d691e95f84713bdd5ad5ffed2
WebAPI/Controllers/BaseSet/Gy_MaterialController.cs
@@ -2218,6 +2218,24 @@
                //进行需要进行的作废/反作废操作
                if (IsAudit == 0) //作废提交
                {
                    string sql_deleteBeforeCtrl = "exec h_p_Gy_BarCodeBill_Cancelltion_Before " + HInterID;
                    DataSet ds_deleteBeforeCtrl = oCN.RunProcReturn(sql_deleteBeforeCtrl, "h_p_Gy_BarCodeBill_Cancelltion_Before");
                    if (ds_deleteBeforeCtrl == null || ds_deleteBeforeCtrl.Tables.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "作废失败:条码作废前控制失败!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }else if(ds_deleteBeforeCtrl.Tables[0].Rows[0]["HBack"].ToString() != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "作废失败:" + ds_deleteBeforeCtrl.Tables[0].Rows[0]["HRemark"].ToString();
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    oCN.BeginTran();
                    //作废条码
@@ -2329,6 +2347,187 @@
        }
        #endregion
        #region 条码主档维护 批量作废/批量反作废
        /// <summary>
        /// </summary>
        /// <param name="HInterID">单据ID</param>
        /// <param name="IsAudit">作废(0),反作废(1)</param>
        /// <param name="CurUserName">作废人</param>
        /// <returns></returns>
        [Route("Gy_BarCodeBillList/DeleteBatchGy_BarCodeBillList")]
        [HttpGet]
        public object DeleteBatchGy_BarCodeBillList(string HInterID, int IsAudit, string CurUserName)
        {
            string ModRightNameCheck = "Gy_BarCodeBillList_Delete";
            DBUtility.ClsPub.CurUserName = CurUserName;
            try
            {
                //检查权限
                if (!DBUtility.ClsPub.Security_Log_second(ModRightNameCheck, 1, false, CurUserName))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "[0000-1-063]作废/反作废失败!无权限!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                //HInterID数据判断
                if (HInterID.Length<=0)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "未选择需要作废/反作废 的条码";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                Int64 lngBillKey = 0;
                lngBillKey = DBUtility.ClsPub.isLong(HInterID);                                         //对HInterID进行类型的转换
                //进行需要进行的作废/反作废操作
                if (IsAudit == 0) //作废提交
                {
                    string sql_deleteBeforeCtrl = "exec h_p_Gy_BarCodeBill_Cancelltion_Before '" + HInterID + "'";
                    DataSet ds_deleteBeforeCtrl = oCN.RunProcReturn(sql_deleteBeforeCtrl, "h_p_Gy_BarCodeBill_Cancelltion_Before");
                    if (ds_deleteBeforeCtrl == null || ds_deleteBeforeCtrl.Tables.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "作废失败:条码作废前控制失败!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    else if (ds_deleteBeforeCtrl.Tables[0].Rows[0]["HBack"].ToString() != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "作废失败:" + ds_deleteBeforeCtrl.Tables[0].Rows[0]["HRemark"].ToString();
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    oCN.BeginTran();
                    //作废条码
                    oCN.RunProc("update Gy_BarCodeBill set HStopflag=1,HDeleteMan='" + CurUserName + "',HDeleteDate=getdate() where HItemID in (" + HInterID + ")", ref DBUtility.ClsPub.sExeReturnInfo);
                    string sql = "select * from Gy_BarCodeBill where HItemID in (" + HInterID + ")";
                    ds = oCN.RunProcReturn(sql, "Gy_BarCodeBill");
                    if (ds != null && ds.Tables[0].Rows.Count > 0)
                    {
                        string HBarCode = "";
                        for(int i = 0; i < ds.Tables[0].Rows.Count; i++)
                        {
                            HBarCode = ds.Tables[0].Rows[0]["HBarCode"].ToString() + ";";
                        }
                        //添加操作日志
                        oCN.RunProc("Insert into System_log (GeginDate, userid, WorkstationName, WorkList, SystemName, NetuserName, State) select GETDATE(),'" + CurUserName + "','" + DBUtility.ClsPub.ComputerName + "','作废条码:" + HBarCode + "','WMS系统-条码档案列表模块','" + DBUtility.ClsPub.IPAddress + "','作废'", ref DBUtility.ClsPub.sExeReturnInfo);
                        objJsonResult.code = "1";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "[0000-1-040]作废成功";
                        objJsonResult.data = null;
                        oCN.Commit();
                    }
                    else
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "[0000-1-042]作废失败!原因:" + DBUtility.ClsPub.sExeReturnInfo;
                        objJsonResult.data = null;
                        oCN.RollBack();
                    }
                    return objJsonResult;
                }
                if (IsAudit == 1) //反关闭提交
                {
                    oCN.BeginTran();
                    //#region 反作废条码前进行判断
                    ////反作废条码前进行判断------------------------------------------------------------------------------------------------------------------------------------------------------
                    ////--------------------------------------------------------------------------------------------------------------------------------------------------------------------------
                    //DataSet DS = oCN.RunProcReturn("exec h_p_Gy_BarCodeBill_UnCancelltion '" + HInterID + "','N'", "h_p_Gy_BarCodeBill_UnCancelltion", ref DBUtility.ClsPub.sExeReturnInfo);
                    //if (DS == null || DS.Tables[0].Rows.Count <= 0)
                    //{
                    //    oCN.RollBack();
                    //    objJsonResult.code = "0";
                    //    objJsonResult.count = 0;
                    //    objJsonResult.Message = "[0000-1-042]反作废失败,原因:反作废条码前判断发生错误!";
                    //    objJsonResult.data = null;
                    //    return objJsonResult;
                    //}
                    //else
                    //{
                    //    if (DBUtility.ClsPub.isStrNull(DS.Tables[0].Rows[0][0]) == "1")
                    //    {
                    //        oCN.RollBack();
                    //        objJsonResult.code = "1";
                    //        objJsonResult.count = 1;
                    //        objJsonResult.Message = "[0000-1-042]反作废失败,原因:" + DBUtility.ClsPub.isStrNull(DS.Tables[0].Rows[0]["HRemark"]);
                    //        objJsonResult.data = null;
                    //        return objJsonResult;
                    //    }
                    //}
                    ////--------------------------------------------------------------------------------------------------------------------------------------------------------------------------
                    ////--------------------------------------------------------------------------------------------------------------------------------------------------------------------------
                    //#endregion
                    //反作废条码
                    oCN.RunProc("update Gy_BarCodeBill set HStopflag=0,HDeleteMan='',HDeleteDate=null where HItemID in (" + HInterID + ")", ref DBUtility.ClsPub.sExeReturnInfo);
                    //增加操作日志
                    string sql = "select * from Gy_BarCodeBill where HItemID in (" + HInterID + ")";
                    ds = oCN.RunProcReturn(sql, "Gy_BarCodeBill");
                    if (ds != null && ds.Tables[0].Rows.Count > 0)
                    {
                        string HBarCode = "";
                        for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                        {
                            HBarCode = ds.Tables[0].Rows[0]["HBarCode"].ToString() + ";";
                        }
                        oCN.RunProc("Insert into System_log (GeginDate, userid, WorkstationName, WorkList, SystemName, NetuserName, State) select GETDATE(),'" + CurUserName + "','" + DBUtility.ClsPub.ComputerName + "','反作废条码:" + HBarCode + "','WMS系统-条码档案列表模块','" + DBUtility.ClsPub.IPAddress + "','反作废'", ref DBUtility.ClsPub.sExeReturnInfo);
                        objJsonResult.code = "1";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "[0000-1-043]反作废成功";
                        objJsonResult.data = null;
                        oCN.Commit();
                        return objJsonResult;
                    }
                    else
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "[0000-1-042]反作废失败!原因:" + DBUtility.ClsPub.sExeReturnInfo;
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                }
                return objJsonResult;
            }
            catch (Exception e)
            {
                oCN.RollBack();
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "[0000-1-044]作废失败或者反作废失败!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
        #region[器具档案编辑时获取子表数据]
        [Route("Gy_MouldFileMain/Gy_MouldFileSubDetai")]
        [HttpGet]