新增网页工资结算单(个人)新增模块、生产入库单列表模块相关调用方法
6个文件已修改
1059 ■■■■ 已修改文件
DAL/工资管理/ClsPay_SingleBalBill.cs 180 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Model/工资管理/ClsPay_SingleBalBillSub.cs 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Controllers/仓存管理/验收入库/Kf_ProductInBillController.cs 621 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Controllers/基础资料/工资基础资料/Gy_WorkTypeController.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Controllers/工资管理/Pay_SingleBalBillController.cs 251 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Web.config 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DAL/¹¤×ʹÜÀí/ClsPay_SingleBalBill.cs
@@ -29,15 +29,75 @@
        {
            DetailColl = null;
        }
        #endregion   è‡ªå®šä¹‰æ–¹æ³•
        //保存前控制
        public bool BeforeSave(Int64 HInterID, string HBillNo, Int64 OperationType, ref string sReturn)
        {
            try
            {
                DataSet Ds = oCn.RunProcReturn("Exec h_p_Pay_SingleBalBill_BeforeSaveCtrl " + HInterID.ToString() + ",'" + HBillNo + "'," + OperationType.ToString(), "h_p_Pay_SingleBalBill_BeforeSaveCtrl");
                if (Ds == null || Ds.Tables[0].Rows.Count == 0)
                {
                    sReturn = "保存前判断失败!";
                    return false;
                }
                else
                {
                    if (DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HBack"]) == 1)
                    {
                        sReturn = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HRemark"]);
                        return false;
                    }
                }
                return true;
            }
            catch (Exception e)
            {
                throw (e);
            }
        }
        //保存后控制
        public bool AfterSave(Int64 HInterID, string HBillNo, Int64 OperationType, ref string sReturn)
        {
            try
            {
                DataSet Ds = oCn.RunProcReturn("Exec h_p_Pay_SingleBalBill_AfterSaveCtrl " + HInterID.ToString() + ",'" + HBillNo + "'," + OperationType.ToString(), "h_p_Pay_SingleBalBill_AfterSaveCtrl");
                if (Ds == null || Ds.Tables[0].Rows.Count == 0)
                {
                    sReturn = "保存后判断失败!";
                    return false;
                }
                else
                {
                    if (DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HBack"]) == 1)
                    {
                        sReturn = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HRemark"]);
                        return false;
                    }
                }
                return true;
            }
            catch (Exception e)
            {
                throw (e);
            }
        }
        //修改单据
        public override bool ModifyBill(Int64 lngBillKey, ref string sReturn)
        {
            try
            {
                //
                oCn.BeginTran();
                //保存前控制
                if (!BeforeSave(lngBillKey, omodel.HBillNo, 2, ref sReturn))
                {
                    oCn.RollBack();
                    return false;
                }
                //更新主表
                oCn.RunProc("UpDate Pay_SingleBalBillMain set  " +
                " HBillNo='" + omodel.HBillNo + "'" +  //固定赋值===============
@@ -48,12 +108,13 @@
                ",HUpDater='" + DBUtility.ClsPub.CurUserName + "'" +
                ",HUpDateDate=getdate()" +
                //========================================
                ",HGroupID=" + omodel.HGroupID.ToString() +
                ",HDeptID=" + omodel.HDeptID.ToString() +
                ",HGroupID=" + omodel.HGroupID.ToString() +
                ",HEmpID=" + omodel.HEmpID.ToString() +
                ",HPayType=" + omodel.HPayType.ToString() +
                ",HPayType='" + omodel.HPayType + "'" +
                ",HExplanation='" + omodel.HExplanation + "'" +
                ",HInnerBillNo='" + omodel.HInnerBillNo + "'" +
                ",HStockOrgID=" + omodel.HSTOCKORGID.ToString() +
                " where HInterID=" + lngBillKey.ToString());
                //删除关联
                DeleteRelation(ref sReturn, lngBillKey);
@@ -64,37 +125,30 @@
                foreach (Model.ClsPay_SingleBalBillSub oSub in DetailColl)
                {
                    oCn.RunProc("Insert into Pay_SingleBalBillSub " +
                      " (HInterID,HEntryID,HCloseMan,HEntryCloseDate,HCloseType,HRemark" +
                      ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" +
                      ",HMaterID,HProcID,HEmpID,HSourceID,HTimes,HQty,HPrice,HSqty" +
                      ",HMoney,HICMOInterID,HICMOBillNo,HProcReportInterID,HProcReportEntryID,HProcReportBillNo" +
                      " (HInterID,HEntryID,HRemark,HRelationQty,HRelationMoney" +
                      ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType" +
                      ",HMaterID,HProcID,HSourceID,HEmpID,HTimes,HQty" +
                      ",HPrice,HPackQty,HPackPrice,HPackMoney,HPackMaterID,HPriceRate" +
                      ",HSubsidyID,HSubsidyTotal,HDeuctID,HDeuctTotal,HSubsidyQty,HSubsidyMoney,HMoney" +
                      ",HICMOInterID,HICMOEntryID,HICMOBillNo,HProcReportInterID,HProcReportEntryID,HProcReportBillNo" +
                      ",HProcPlanInterID,HProcPlanEntryID,HProcPlanBillNo" +
                      ",HPriceRate,HSubsidyTotal,HDeuctTotal,HSubsidyID,HDeuctID" +
                      ",HPackQty,HPackPrice,HPackMoney,HPackMaterID,HSubsidyQty,HSubsidyMoney" +
                      ") values("
                      + omodel.HInterID.ToString() + "," + oSub.HEntryID.ToString() + ",'" + oSub.HCloseMan + "','" + oSub.HEntryCloseDate.ToShortDateString() + "'," + Convert.ToString(oSub.HCloseType ? 1 : 0) + ",'" + oSub.HRemark + "'" +
                      "," + oSub.HSourceInterID.ToString() + "," + oSub.HSourceEntryID.ToString() + ",'" + oSub.HSourceBillNo + "','" + oSub.HSourceBillType + "'," + oSub.HRelationQty.ToString() + "," + oSub.HRelationMoney.ToString() +
                      "," + oSub.HMaterID.ToString() + "," + oSub.HProcID.ToString() + "," + oSub.HEmpID.ToString() + "," + oSub.HSourceID.ToString()
                      + "," + oSub.HTimes.ToString() + "," + oSub.HQty.ToString() + "," + oSub.HPrice.ToString() + "," + oSub.HSqty.ToString() +
                      "," + oSub.HMoney.ToString() + "," + oSub.HICMOInterID.ToString() + ",'" + oSub.HICMOBillNo + "'," + oSub.HProcReportInterID.ToString() + "," + oSub.HProcReportEntryID.ToString() + ",'" + oSub.HProcReportBillNo + "'" +
                      + omodel.HInterID.ToString() + "," + oSub.HEntryID.ToString() + ",'" + oSub.HRemark + "'," + oSub.HRelationQty.ToString() + "," + oSub.HRelationMoney.ToString() +
                      "," + oSub.HSourceInterID.ToString() + "," + oSub.HSourceEntryID.ToString() + ",'" + oSub.HSourceBillNo + "','" + oSub.HSourceBillType + "'" +
                      "," + oSub.HMaterID.ToString() + "," + oSub.HProcID.ToString() + "," + oSub.HSourceID.ToString() + "," + oSub.HEmpID.ToString() + "," + oSub.HTimes.ToString() + "," + oSub.HQty.ToString() +
                      "," + oSub.HPrice.ToString() + "," + oSub.HPackQty.ToString() + "," + oSub.HPackPrice.ToString() + "," + oSub.HPackMoney.ToString() + "," + oSub.HPackMaterID.ToString() + "," + oSub.HPriceRate.ToString() +
                      "," + oSub.HSubsidyID.ToString() + "," + oSub.HSubsidyTotal.ToString() + "," + oSub.HDeuctID.ToString() + "," + oSub.HDeuctTotal.ToString() + "," + oSub.HSubsidyQty.ToString() + "," + oSub.HSubsidyMoney.ToString() + "," + oSub.HMoney.ToString() +
                      "," + oSub.HICMOInterID.ToString() + "," + oSub.HICMOEntryID.ToString() + ",'" + oSub.HICMOBillNo + "'," + oSub.HProcReportInterID.ToString() + "," + oSub.HProcReportEntryID.ToString() + ",'" + oSub.HProcReportBillNo + "'" +
                      "," + oSub.HProcPlanInterID.ToString() + "," + oSub.HProcPlanEntryID.ToString() + ",'" + oSub.HProcPlanBillNo + "'" +
                      "," + oSub.HPriceRate.ToString() + "," + oSub.HSubsidyTotal.ToString() + "," + oSub.HDeuctTotal.ToString() + "," + oSub.HSubsidyID.ToString() + "," + oSub.HDeuctID.ToString() +
                      "," + oSub.HPackQty.ToString() + "," + oSub.HPackPrice.ToString() + "," + oSub.HPackMoney.ToString() + "," + oSub.HPackMaterID.ToString() + "," + oSub.HSubsidyQty.ToString() + "," + oSub.HSubsidyMoney.ToString() +
                      ") ");
                }
                //
                //foreach (Model.ClsPay_SingleBalBillSub oSub in DetailColl)
                //{
                //    Ds = oCn.RunProcReturn("exec h_p_Pay_SingleBalBill_Qty " + oSub.HICMOInterID, "");
                //    if (Ds.Tables[0].Rows.Count == 0)
                //        return;
                //    if (DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBool"]) == "Y")
                //    {
                //        sReturn = "汇报数量超过计划数量!不允许保存";
                //        return false;
                //    }
                //}
                sReturn = "修改单据成功!";
                //保存后控制
                if (!AfterSave(lngBillKey, omodel.HBillNo, 2, ref sReturn))
                {
                    oCn.RollBack();
                    return false;
                }
                sReturn = "单据号:" + omodel.HBillNo + " ä¿®æ”¹æˆåŠŸï¼";
                oCn.Commit();
                return true;
            }
@@ -114,52 +168,54 @@
                omodel.HInterID = DBUtility.ClsPub.CreateBillID(BillType, ref DBUtility.ClsPub.sExeReturnInfo);
                //若MAINDI重复则重新获取
                oCn.BeginTran();
                //保存前控制
                if (!BeforeSave(omodel.HInterID, omodel.HBillNo, 1, ref sReturn))
                {
                    oCn.RollBack();
                    return false;
                }
                //主表
                oCn.RunProc("Insert Into Pay_SingleBalBillMain   " +
                "(HBillType,HBillSubType,HInterID,HBillNo,HDate" +
                ",HYear,HPeriod,HRemark,HMaker,HMakeDate,HSaveFlag" +
                ",HGroupID,HDeptID,HEmpID,HPayType,HExplanation,HInnerBillNo" +
                ",HYear,HPeriod,HRemark,HMaker,HMakeDate" +
                ",HMainSourceInterID,HMainSourceEntryID,HMainSourceBillNo,HMainSourceBillType" +
                ",HDeptID,HGroupID,HEmpID,HPayType,HExplanation" +
                ",HSaveFlag,HInnerBillNo,HStockOrgID" +
                ") " +
                " values('" + this.BillType + "','"  + this.HBillSubType + "'," +omodel.HInterID.ToString() + ",'" + omodel.HBillNo + "','" + omodel.HDate + "'" +
                ", " + omodel.HYear.ToString() + "," + omodel.HPeriod.ToString() + ",'" + omodel.HRemark + "','" + DBUtility.ClsPub.CurUserName + "',getdate()," + Convert.ToString(omodel.HSaveFlag ? 1 : 0) +
                ", " + omodel.HGroupID.ToString() + "," + omodel.HDeptID.ToString() + "," + omodel.HEmpID.ToString() + "," + omodel.HPayType.ToString() + ",'" + omodel.HExplanation + "','" + omodel.HInnerBillNo + "'" +
                " values('" + this.BillType + "','" + this.HBillSubType + "'," + omodel.HInterID.ToString() + ",'" + omodel.HBillNo + "','" + omodel.HDate.ToShortDateString() + "'" +
                ", " + omodel.HYear.ToString() + "," + omodel.HPeriod.ToString() + ",'" + omodel.HRemark + "','" + DBUtility.ClsPub.CurUserName + "',getdate()" +
                ", " + omodel.HMainSourceInterID.ToString() + "," + omodel.HMainSourceEntryID.ToString() + ",'" + omodel.HMainSourceBillNo + "','" + omodel.HMainSourceBillType + "'" +
                ", " + omodel.HDeptID.ToString() + "," + omodel.HGroupID.ToString() + "," + omodel.HEmpID.ToString() + "," + omodel.HPayType.ToString() + ",'" + omodel.HExplanation + "'" +
                ", " + Convert.ToString(omodel.HSaveFlag ? 1 : 0) + ",'" + omodel.HInnerBillNo + "'," + omodel.HSTOCKORGID.ToString() +
                ") ");
                //插入子表
                foreach (Model.ClsPay_SingleBalBillSub oSub in DetailColl)
                {
                    oCn.RunProc("Insert into Pay_SingleBalBillSub " +
                      " (HInterID,HEntryID,HCloseMan,HEntryCloseDate,HCloseType,HRemark" +
                      ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" +
                      ",HMaterID,HProcID,HEmpID,HSourceID,HTimes,HQty,HPrice,HSqty" +
                      ",HMoney,HICMOInterID,HICMOBillNo,HProcReportInterID,HProcReportEntryID,HProcReportBillNo" +
                      " (HInterID,HEntryID,HRemark,HRelationQty,HRelationMoney" +
                      ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType" +
                      ",HMaterID,HProcID,HSourceID,HEmpID,HTimes,HQty" +
                      ",HPrice,HPackQty,HPackPrice,HPackMoney,HPackMaterID,HPriceRate" +
                      ",HSubsidyID,HSubsidyTotal,HDeuctID,HDeuctTotal,HSubsidyQty,HSubsidyMoney,HMoney" +
                      ",HICMOInterID,HICMOEntryID,HICMOBillNo,HProcReportInterID,HProcReportEntryID,HProcReportBillNo" +
                      ",HProcPlanInterID,HProcPlanEntryID,HProcPlanBillNo" +
                      ",HPriceRate,HSubsidyTotal,HDeuctTotal,HSubsidyID,HDeuctID" +
                      ",HPackQty,HPackPrice,HPackMoney,HPackMaterID,HSubsidyQty,HSubsidyMoney" +
                      ") values("
                      + omodel.HInterID.ToString() + "," + oSub.HEntryID.ToString() + ",'" + oSub.HCloseMan + "','" + oSub.HEntryCloseDate.ToShortDateString() + "'," + Convert.ToString(oSub.HCloseType ? 1 : 0) + ",'" + oSub.HRemark + "'" +
                      "," + oSub.HSourceInterID.ToString() + "," + oSub.HSourceEntryID.ToString() + ",'" + oSub.HSourceBillNo + "','" + oSub.HSourceBillType + "'," + oSub.HRelationQty.ToString() + "," + oSub.HRelationMoney.ToString() +
                      "," + oSub.HMaterID.ToString() + "," + oSub.HProcID.ToString() + "," + oSub.HEmpID.ToString() + "," + oSub.HSourceID.ToString()
                      + "," + oSub.HTimes.ToString() + "," + oSub.HQty.ToString() + "," + oSub.HPrice.ToString() + "," + oSub.HSqty.ToString() +
                      "," + oSub.HMoney.ToString() + "," + oSub.HICMOInterID.ToString() + ",'" + oSub.HICMOBillNo + "'," + oSub.HProcReportInterID.ToString() + "," + oSub.HProcReportEntryID.ToString() + ",'" + oSub.HProcReportBillNo + "'" +
                      + omodel.HInterID.ToString() + "," + oSub.HEntryID.ToString() + ",'" + oSub.HRemark + "'," + oSub.HRelationQty.ToString() + "," + oSub.HRelationMoney.ToString() +
                      "," + oSub.HSourceInterID.ToString() + "," + oSub.HSourceEntryID.ToString() + ",'" + oSub.HSourceBillNo + "','" + oSub.HSourceBillType + "'" +
                      "," + oSub.HMaterID.ToString() + "," + oSub.HProcID.ToString() + "," + oSub.HSourceID.ToString() + "," + oSub.HEmpID.ToString() + "," + oSub.HTimes.ToString() + "," + oSub.HQty.ToString() +
                      "," + oSub.HPrice.ToString() + "," + oSub.HPackQty.ToString() + "," + oSub.HPackPrice.ToString() + "," + oSub.HPackMoney.ToString() + "," + oSub.HPackMaterID.ToString() + "," + oSub.HPriceRate.ToString() +
                      "," + oSub.HSubsidyID.ToString() + "," + oSub.HSubsidyTotal.ToString() + "," + oSub.HDeuctID.ToString() + "," + oSub.HDeuctTotal.ToString() + "," + oSub.HSubsidyQty.ToString() + "," + oSub.HSubsidyMoney.ToString() + "," + oSub.HMoney.ToString() +
                      "," + oSub.HICMOInterID.ToString() + "," + oSub.HICMOEntryID.ToString() + ",'" + oSub.HICMOBillNo + "'," + oSub.HProcReportInterID.ToString() + "," + oSub.HProcReportEntryID.ToString() + ",'" + oSub.HProcReportBillNo + "'" +
                      "," + oSub.HProcPlanInterID.ToString() + "," + oSub.HProcPlanEntryID.ToString() + ",'" + oSub.HProcPlanBillNo + "'" +
                      "," + oSub.HPriceRate.ToString() + "," + oSub.HSubsidyTotal.ToString() + "," + oSub.HDeuctTotal.ToString() + "," + oSub.HSubsidyID.ToString() + "," + oSub.HDeuctID.ToString() +
                      "," + oSub.HPackQty.ToString() + "," + oSub.HPackPrice.ToString() + "," + oSub.HPackMoney.ToString() + "," + oSub.HPackMaterID.ToString() + "," + oSub.HSubsidyQty.ToString() + "," + oSub.HSubsidyMoney.ToString() +
                      ") ");
                }
                //
                //foreach (Model.ClsPay_SingleBalBillSub oSub in DetailColl)
                //{
                //    Ds = oCn.RunProcReturn("exec h_p_Pay_SingleBalBill_Qty " + oSub.HICMOInterID, "");
                //    if (Ds.Tables[0].Rows.Count == 0)
                //        return;
                //    if (DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBool"]) == "Y")
                //    {
                //        sReturn = "汇报数量超过计划数量!不允许保存";
                //        return false;
                //    }
                //}
                //
                sReturn = "新增单据成功!";
                //保存后控制
                if (!AfterSave(omodel.HInterID, omodel.HBillNo, 1, ref sReturn))
                {
                    oCn.RollBack();
                    return false;
                }
                sReturn = "单据号:" + omodel.HBillNo + " æ–°å¢žæˆåŠŸï¼";
                oCn.Commit();
                return true;
            }
Model/¹¤×ʹÜÀí/ClsPay_SingleBalBillSub.cs
@@ -21,6 +21,7 @@
        public double HMoney;//        decimal(18,8)        --金额 
        public Int64 HICMOInterID;//    int        --生产任务单ID
        public Int64 HICMOEntryID;//    int        --生产任务单子ID
        public string HICMOBillNo;//    varchar(50)        --生产任务单号
        public Int64 HProcReportInterID;//        int      --工序汇报单ID
        public Int64 HProcReportEntryID;//    int    --工序汇报单子ID
WebAPI/Controllers/²Ö´æ¹ÜÀí/ÑéÊÕÈë¿â/Kf_ProductInBillController.cs
@@ -12,18 +12,541 @@
namespace WebAPI.Controllers
{
    //生产入库单Controller
    public class Kf_ProductInBillController : ApiController
    {
        //获取系统参数
        Pub_Class.ClsXt_SystemParameter oSystemParameter = new Pub_Class.ClsXt_SystemParameter();
        public DBUtility.ClsPub.Enum_BillStatus BillStatus;
        public DAL.ClsKf_ProductInBill BillOld = new DAL.ClsKf_ProductInBill();
        public const string ModName = "1202";                   //单据类型
        public const string ModCaption = "生产入库单";          //单据名称
        public const string ModRightName = "Kf_ProductInBill";
        public const string ModRightNameList = ModRightName + "List";       //列表
        public const string ModRightNameEdit = ModRightName + "_Edit";      //编辑
        public const string ModRightNameCheck = ModRightName + "_Check";    //审核
        public const string ModRightNameClose = ModRightName + "_Close";    //关闭
        public const string ModRightNameDelete = ModRightName + "_Delete";  //作废
        public const string ModRightNameDrop = ModRightName + "_Drop";      //删除
        public const string ModRightNameMoney = ModRightName + "_Money";    //金额
        public const string ModRightNameQty = ModRightName + "_Qty";        //数量
        public DataSet ds = new DataSet();
        private json objJsonResult = new json();
        SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
        DataSet ds;
        SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
        public DAL.ClsKf_ProductInBill oBill = new DAL.ClsKf_ProductInBill();
        public DAL.ClsKf_ProductInBill BillOld = new DAL.ClsKf_ProductInBill();
        #region ç”Ÿäº§å…¥åº“单列表
        /// <summary>
        /// èŽ·å–ç”Ÿäº§å…¥åº“å•åˆ—è¡¨ä¿¡æ¯
        /// </summary>
        /// <returns></returns>
        [Route("Kf_ProductInBillController/GetKf_ProductInBillList_Json")]
        [HttpGet]
        public object GetKf_ProductInBillList_Json(string sWhere, string HMaker, string OperationType, string ViewName)
        {
            try
            {
                //判断权限
                if (OperationType == "1")
                {
                    //判断权限
                    if (!DBUtility.ClsPub.Security_Log(ModRightNameList, 3, false, HMaker))
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "您没有该模块权限,请与管理员联系!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                }
                //返回列表信息
                ds = oCn.RunProcReturn("select * from " + ViewName + " where 1=1 " + sWhere + " order by hmainid desc", ViewName);
                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));  //获取到DataColumn列对象的列名
                }
                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
        #region ç”Ÿäº§å…¥åº“单 åˆ é™¤
        /// <summary>
        /// åˆ é™¤ç”Ÿäº§å…¥åº“单
        /// </summary>
        /// <returns></returns>
        [Route("Kf_ProductInBillController/GetKf_ProductInBill_Delete_Json")]
        [HttpGet]
        public object GetKf_ProductInBill_Delete_Json(Int64 HInterID, string HMaker)
        {
            try
            {
                //判断权限
                if (!DBUtility.ClsPub.Security_Log(ModRightNameDrop, 3, false, HMaker))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "您没有该模块删除功能权限,请与管理员联系!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                //判断存在性
                if (oBill.ShowBill(HInterID, ref DBUtility.ClsPub.sExeReturnInfo))
                {
                    //删除前控制
                    DataSet BeforeDs = oCn.RunProcReturn("Exec h_p_Kf_ProductInBill_BeforeDelCtrl " + HInterID.ToString() + ",'" + HMaker + "'", "h_p_Kf_ProductInBill_BeforeDelCtrl");
                    if (BeforeDs == null || BeforeDs.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "删除前判断失败!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    else
                    {
                        if (DBUtility.ClsPub.isLong(BeforeDs.Tables[0].Rows[0]["HBack"]) == 1)
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "删除失败!" + DBUtility.ClsPub.isStrNull(BeforeDs.Tables[0].Rows[0]["HRemark"]);
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                    }
                    //删除单据(包含删除后控制、写入日志)
                    if (!oBill.DeleteBill(oBill.omodel.HInterID, oBill.omodel.HBillNo, "h_p_Kf_ProductInBill_AfterDelCtrl", HMaker, ref ClsPub.sExeReturnInfo))
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "删除失败!原因:" + ClsPub.sExeReturnInfo;
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    else
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "删除生产入库单成功!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                }
                else
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    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 ç”Ÿäº§å…¥åº“单 å®¡æ ¸/反审核
        /// <summary>
        /// å®¡æ ¸/反审核生产入库单
        /// </summary>
        /// <param name="HInterID">单据ID</param>
        /// <param name="Type">审核(1),反审核(2)</param>
        /// <param name="HMaker">审核人</param>
        /// <returns></returns>
        [Route("Kf_ProductInBillController/GetKf_ProductInBill_Check_Json")]
        [HttpGet]
        public object GetKf_ProductInBill_Check_Json(Int64 HInterID, int Type, string HMaker)
        {
            try
            {
                //判断权限
                if (!DBUtility.ClsPub.Security_Log(ModRightNameCheck, 3, false, HMaker))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "您没有该模块审核/反审核功能权限,请与管理员联系!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                //判断存在性
                if (oBill.ShowBill(HInterID, ref DBUtility.ClsPub.sExeReturnInfo))
                {
                    //Type 1 å®¡æ ¸  2  åå®¡æ ¸
                    if (Type == 1)
                    {
                        if (oBill.omodel.HChecker.Trim() != "")
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "单据已审核,不能再次审核!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                        if (oBill.omodel.HCloseMan.Trim() != "")
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "单据已关闭,不能再次审核!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                        if (oBill.omodel.HDeleteMan.Trim() != "")
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "单据已作废,不能再次审核!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                        //审核前控制
                        DataSet BeforeDs = oCn.RunProcReturn("Exec h_p_Kf_ProductInBill_BeforeCheckCtrl " + HInterID.ToString() + ",'" + HMaker + "'", "h_p_Kf_ProductInBill_BeforeCheckCtrl");
                        if (BeforeDs == null || BeforeDs.Tables[0].Rows.Count == 0)
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "审核前判断失败!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                        else
                        {
                            if (DBUtility.ClsPub.isLong(BeforeDs.Tables[0].Rows[0]["HBack"]) == 1)
                            {
                                objJsonResult.code = "0";
                                objJsonResult.count = 0;
                                objJsonResult.Message = "审核失败!" + DBUtility.ClsPub.isStrNull(BeforeDs.Tables[0].Rows[0]["HRemark"]);
                                objJsonResult.data = null;
                                return objJsonResult;
                            }
                        }
                        //审核单据
                        if (!oBill.CheckBill(HInterID, oBill.omodel.HBillNo, "h_p_Kf_ProductInBill_AfterCheckCtrl", HMaker, ref ClsPub.sExeReturnInfo))
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "审核失败!原因:" + ClsPub.sExeReturnInfo;
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                        else
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 1;
                            objJsonResult.Message = "单据号:" + oBill.omodel.HBillNo + " å®¡æ ¸æˆåŠŸï¼";
                            objJsonResult.data = null;
                            return objJsonResult; ;
                        }
                    }
                    else
                    {
                        if (oBill.omodel.HChecker.Trim() == "")
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "单据未审核,不需要反审核!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                        //反审核前控制
                        DataSet BeforeDs = oCn.RunProcReturn("Exec h_p_Kf_ProductInBill_BeforeUnCheckCtrl " + HInterID.ToString() + ",'" + HMaker + "'", "h_p_Kf_ProductInBill_BeforeUnCheckCtrl");
                        if (BeforeDs == null || BeforeDs.Tables[0].Rows.Count == 0)
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "反审核前判断失败!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                        else
                        {
                            if (DBUtility.ClsPub.isLong(BeforeDs.Tables[0].Rows[0]["HBack"]) == 1)
                            {
                                objJsonResult.code = "0";
                                objJsonResult.count = 0;
                                objJsonResult.Message = "反审核失败!" + DBUtility.ClsPub.isStrNull(BeforeDs.Tables[0].Rows[0]["HRemark"]);
                                objJsonResult.data = null;
                                return objJsonResult;
                            }
                        }
                        //反审核单据
                        if (!oBill.AbandonCheck(HInterID, oBill.omodel.HBillNo, "h_p_Kf_ProductInBill_AfterUnCheckCtrl", HMaker, ref ClsPub.sExeReturnInfo))
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "反审核失败!原因:" + ClsPub.sExeReturnInfo;
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                        else
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 1;
                            objJsonResult.Message = "单据号:" + oBill.omodel.HBillNo + " åå®¡æ ¸æˆåŠŸï¼";
                            objJsonResult.data = null;
                            return objJsonResult; ;
                        }
                    }
                }
                else
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    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 ç”Ÿäº§å…¥åº“单 å…³é—­/反关闭
        /// <summary>
        /// å…³é—­/反关闭生产入库单
        /// </summary>
        /// <param name="HInterID">单据ID</param>
        /// <param name="Type">关闭(1),反关闭(2)</param>
        /// <param name="HMaker">关闭人</param>
        /// <returns></returns>
        [Route("Kf_ProductInBillController/GetKf_ProductInBill_Close_Json")]
        [HttpGet]
        public object GetKf_ProductInBill_Close_Json(Int64 HInterID, int Type, string HMaker)
        {
            try
            {
                //判断权限
                if (!DBUtility.ClsPub.Security_Log(ModRightNameClose, 3, false, HMaker))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "您没有该模块关闭/反关闭功能权限,请与管理员联系!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                //判断存在性
                if (oBill.ShowBill(HInterID, ref DBUtility.ClsPub.sExeReturnInfo))
                {
                    //Type 1 å…³é—­  2  åå…³é—­
                    if (Type == 1)
                    {
                        if (oBill.omodel.HCloseMan.Trim() != "")
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "单据已关闭,不能再次关闭!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                        //关闭单据
                        if (!oBill.CloseBill(HInterID, oBill.omodel.HBillNo, HMaker, ref ClsPub.sExeReturnInfo))
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "关闭失败!原因:" + ClsPub.sExeReturnInfo;
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                        else
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 1;
                            objJsonResult.Message = "单据号:" + oBill.omodel.HBillNo + " å…³é—­æˆåŠŸï¼";
                            objJsonResult.data = null;
                            return objJsonResult; ;
                        }
                    }
                    else
                    {
                        if (oBill.omodel.HCloseMan.Trim() == "")
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "单据未关闭,不需要反关闭!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                        //反关闭单据
                        if (!oBill.CancelClose(HInterID, oBill.omodel.HBillNo, HMaker, ref ClsPub.sExeReturnInfo))
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "反关闭失败!原因:" + ClsPub.sExeReturnInfo;
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                        else
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 1;
                            objJsonResult.Message = "单据号:" + oBill.omodel.HBillNo + " åå…³é—­æˆåŠŸï¼";
                            objJsonResult.data = null;
                            return objJsonResult; ;
                        }
                    }
                }
                else
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    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 ç”Ÿäº§å…¥åº“单 ä½œåºŸ/反作废
        /// <summary>
        /// ä½œåºŸ/反作废生产入库单
        /// </summary>
        /// <param name="HInterID">单据ID</param>
        /// <param name="Type">作废(1),反作废(2)</param>
        /// <param name="HMaker">作废人</param>
        /// <returns></returns>
        [Route("Kf_ProductInBillController/GetKf_ProductInBill_Cancelltion_Json")]
        [HttpGet]
        public object GetKf_ProductInBill_Cancelltion_Json(Int64 HInterID, int Type, string HMaker)
        {
            try
            {
                //判断权限
                if (!DBUtility.ClsPub.Security_Log(ModRightNameDelete, 3, false, HMaker))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "您没有该模块作废/反作废功能权限,请与管理员联系!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                //判断存在性
                if (oBill.ShowBill(HInterID, ref DBUtility.ClsPub.sExeReturnInfo))
                {
                    //Type 1 ä½œåºŸ  2  åä½œåºŸ
                    if (Type == 1)
                    {
                        if (oBill.omodel.HDeleteMan.Trim() != "")
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "单据已作废,不能再次作废!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                        //作废单据
                        if (!oBill.Cancelltion(HInterID, oBill.omodel.HBillNo, HMaker, ref ClsPub.sExeReturnInfo))
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "作废失败!原因:" + ClsPub.sExeReturnInfo;
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                        else
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 1;
                            objJsonResult.Message = "单据号:" + oBill.omodel.HBillNo + " ä½œåºŸæˆåŠŸï¼";
                            objJsonResult.data = null;
                            return objJsonResult; ;
                        }
                    }
                    else
                    {
                        if (oBill.omodel.HDeleteMan.Trim() == "")
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "单据未作废,不需要反作废!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                        //反作废单据
                        if (!oBill.AbandonCancelltion(HInterID, oBill.omodel.HBillNo, HMaker, ref ClsPub.sExeReturnInfo))
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "反作废失败!原因:" + ClsPub.sExeReturnInfo;
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                        else
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 1;
                            objJsonResult.Message = "单据号:" + oBill.omodel.HBillNo + " åä½œåºŸæˆåŠŸï¼";
                            objJsonResult.data = null;
                            return objJsonResult; ;
                        }
                    }
                }
                else
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    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
        //---------------------------------------------------------------------------------------------旧方法20240422前
        #region ç”Ÿäº§å…¥åº“单 æŸ¥æ‰¾è®°å½•功能
        /// <summary>
@@ -38,7 +561,7 @@
            try
            {
                ds = oCN.RunProcReturn("select * from h_v_IF_ProductInBillList where hmainid=" + HInterID, "h_v_IF_ProductInBillList");
                ds = oCn.RunProcReturn("select * from h_v_IF_ProductInBillList where hmainid=" + HInterID, "h_v_IF_ProductInBillList");
                if (ds == null || ds.Tables[0].Rows.Count == 0)
                {
                    objJsonResult.code = "0";
@@ -91,12 +614,12 @@
                if (sWhere == null || sWhere.Equals(""))
                {
                    ds = oCN.RunProcReturn("select * from h_v_IF_ProductInBillList where 1=1  order by hmainid desc", "h_v_IF_ProductInBillList");
                    ds = oCn.RunProcReturn("select * from h_v_IF_ProductInBillList where 1=1  order by hmainid desc", "h_v_IF_ProductInBillList");
                }
                else
                {
                    string sql = "select * from h_v_IF_ProductInBillList where 1 = 1 " + sWhere + " order by hmainid desc";
                    ds = oCN.RunProcReturn(sql, "h_v_IF_ProductInBillList");
                    ds = oCn.RunProcReturn(sql, "h_v_IF_ProductInBillList");
                }
@@ -133,7 +656,7 @@
                string HBillNo = "";
                //删除前控制=========================================      
                string sql1 = "exec h_p_Kf_ProductInBill_BeforeDelCtrl " + HInterID + ",'" + HBillNo + "','" + user + "'";
                ds = oCN.RunProcReturn(sql1, "h_p_Kf_ProductInBill_BeforeDelCtrl");
                ds = oCn.RunProcReturn(sql1, "h_p_Kf_ProductInBill_BeforeDelCtrl");
                if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                {
                    objJsonResult.code = "0";
@@ -154,14 +677,14 @@
                //==================================================================================      
                string sReturn = "";
                oCN.BeginTran();
                oCN.RunProc("Delete From Kf_ICStockBillMain where HInterID = " + HInterID);
                oCN.RunProc("Delete From Kf_ICStockBillSub where HInterID = " + HInterID);
                oCN.Commit();
                oCn.BeginTran();
                oCn.RunProc("Delete From Kf_ICStockBillMain where HInterID = " + HInterID);
                oCn.RunProc("Delete From Kf_ICStockBillSub where HInterID = " + HInterID);
                oCn.Commit();
                //删除后控制==================================================================================      
                string sql2 = "exec h_p_Kf_ProductInBill_AfterDelCtrl " + HInterID + ",'" + HBillNo + "','" + user + "'";
                ds = oCN.RunProcReturn(sql2, "h_p_Kf_ProductInBill_AfterDelCtrl");
                ds = oCn.RunProcReturn(sql2, "h_p_Kf_ProductInBill_AfterDelCtrl");
                if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                {
                    sReturn = "删除后判断失败,请与网络管理人员联系";
@@ -169,7 +692,7 @@
                    objJsonResult.count = 1;
                    objJsonResult.Message = "删除失败!原因:" + sReturn;
                    objJsonResult.data = null;
                    oCN.RollBack();
                    oCn.RollBack();
                    return objJsonResult;
                }
                if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
@@ -179,7 +702,7 @@
                    objJsonResult.count = 1;
                    objJsonResult.Message = "删除失败!原因:" + sReturn;
                    objJsonResult.data = null;
                    oCN.RollBack();
                    oCn.RollBack();
                    return objJsonResult;
                }
                //==============================================================================================
@@ -192,7 +715,7 @@
            }
            catch (Exception e)
            {
                oCN.RollBack();
                oCn.RollBack();
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "Exception!" + e.ToString();
@@ -211,19 +734,19 @@
            {
                var _value = sMainSub["sMainSub"].ToString();
                string msg1 = _value.ToString();
                oCN.BeginTran();
                oCn.BeginTran();
                //保存主表
                objJsonResult = AddBillMain(msg1);
                if (objJsonResult.code == "0")
                {
                    oCN.RollBack();
                    oCn.RollBack();
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = objJsonResult.Message;
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                oCN.Commit();
                oCn.Commit();
                objJsonResult.code = "1";
                objJsonResult.count = 1;
                objJsonResult.Message = "单据保存成功!";
@@ -233,7 +756,7 @@
            }
            catch (Exception e)
            {
                oCN.RollBack();
                oCn.RollBack();
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "保存失败!" + e.ToString();
@@ -304,12 +827,12 @@
                string HSUPPLYADDRESS = mainList2[0].HSUPPLYADDRESS == null ? "''" : mainList2[0].HSUPPLYADDRESS;
                long HPROVIDERCONTACTID = mainList2[0].HPROVIDERCONTACTID == null ? 0 : mainList2[0].HPROVIDERCONTACTID;
                ds = oCN.RunProcReturn("select * from h_v_IF_ProductInBillList where hmainid=" + HInterID + " and å•据号='" + HBillNo + "'", "h_v_IF_ProductInBillList");
                ds = oCn.RunProcReturn("select * from h_v_IF_ProductInBillList where hmainid=" + HInterID + " and å•据号='" + HBillNo + "'", "h_v_IF_ProductInBillList");
                if ((OperationType == 1 || OperationType == 2 || OperationType == 4) && ds.Tables[0].Rows.Count == 0)//新增
                {
                    //保存前控制=========================================
                    ds = oCN.RunProcReturn("exec h_p_Kf_ProductInBill_BeforeSaveCtrl " + HInterID, "h_p_Kf_ProductInBill_BeforeSaveCtrl");
                    ds = oCn.RunProcReturn("exec h_p_Kf_ProductInBill_BeforeSaveCtrl " + HInterID, "h_p_Kf_ProductInBill_BeforeSaveCtrl");
                    if (ds == null || ds.Tables[0].Rows.Count == 0)
                    {
@@ -337,7 +860,7 @@
                    "," + HManagerID + "," + HEmpID + "," + HDeptID + "," + HSecManagerID + "," + HKeeperID + ",'" + HRemark + "','" + HMaker +
                    "',getdate()" + "," + HCurID + "," + HExRate + "," + HWHID + ",'" + HInnerBillNo + "','" + HExplanation + "')";
                    oCN.RunProc(sql);
                    oCn.RunProc(sql);
                }
                else if (OperationType == 3 || ds.Tables[0].Rows.Count != 0)
@@ -348,20 +871,20 @@
                                 + ",HExRate=" + HExRate + ",HEmpID=" + HEmpID + ",HManagerID=" + HManagerID + ",HDeptID=" + HDeptID
                                 + ",HInnerBillNo='" + HInnerBillNo + "' where HInterID=" + HInterID;
                    oCN.RunProc(sql);
                    oCn.RunProc(sql);
                    
                    //删除子表
                    oCN.RunProc("delete from Kf_ICStockBillSub where HInterID='" + HInterID + "'");
                    oCn.RunProc("delete from Kf_ICStockBillSub where HInterID='" + HInterID + "'");
                }
                //保存子表
                objJsonResult = AddBillSub(msg3, HInterID, OperationType, user);
                //生产入库单新增回填生产订单关联数量
                oCN.RunProc("exec h_p_Kf_UpDateRelation_ProductInToICMO_Add " + HInterID);
                oCn.RunProc("exec h_p_Kf_UpDateRelation_ProductInToICMO_Add " + HInterID);
                //生产入库单新增回填生产汇报单关联数量
                oCN.RunProc("exec h_p_Kf_UpDateRelation_ProductInToICMOReport_Add " + HInterID);
                oCn.RunProc("exec h_p_Kf_UpDateRelation_ProductInToICMOReport_Add " + HInterID);
                if (objJsonResult.code == "0")
                {
@@ -445,7 +968,7 @@
                DataSet Cs;
                Int64 NewHEntryID = 1;
                Cs = oCN.RunProcReturn("select MAX(HEntryID)HEntryID from Kf_ICStockBillSub", "Kf_ICStockBillSub");
                Cs = oCn.RunProcReturn("select MAX(HEntryID)HEntryID from Kf_ICStockBillSub", "Kf_ICStockBillSub");
                if (Cs.Tables[0].Rows.Count != 0 && ClsPub.isLong(Cs.Tables[0].Rows[0]["HEntryID"].ToString()) != 0)
                {
                    NewHEntryID = ClsPub.isLong(Cs.Tables[0].Rows[0]["HEntryID"].ToString());
@@ -453,7 +976,7 @@
                }
               
                oCN.RunProc($@"Insert into Kf_ICStockBillSub
                oCn.RunProc($@"Insert into Kf_ICStockBillSub
                (HInterID,HEntryID,HMaterID,HUnitID,HQtyMust,HQty,HPrice
                ,HMoney,HWHID,HSPID,HRemark,HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HPOOrderInterID
                ,HPOOrderEntryID,HPOORderBillNo,HSecUnitID,HSeOrderInterID,HSeOrderEntryID,HSeOrderBillNo,HRelationQty,HSecUnitRate,HPropertyID) 
@@ -463,7 +986,7 @@
            }
            //保存后控制=========================================              
            ds = oCN.RunProcReturn("exec h_p_Kf_ProductInBill_AfterSaveCtrl " + HInterID, "h_p_Kf_ProductInBill_AfterSaveCtrl");
            ds = oCn.RunProcReturn("exec h_p_Kf_ProductInBill_AfterSaveCtrl " + HInterID, "h_p_Kf_ProductInBill_AfterSaveCtrl");
            if (ds == null || ds.Tables[0].Rows.Count == 0)
            {
@@ -496,14 +1019,14 @@
        [HttpGet]
        public ApiResult<DataTable> getMaterialByMaterID(Int64 HMaterID)
        {
            SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
            SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
            string sql = "select a.HItemID HMaterID,a.HNumber HMaterNumber,a.HName HMaterName,a.HMaterRuleType,a.HModel HMaterModel,a.HUnitID, b.HNumber HUnitNumber, b.HName HUnitName" +
                " from Gy_Material AS a " +
                " LEFT OUTER JOIN Gy_Unit AS b on a.HUnitID = b.HItemID " +
                " where a.HItemID =" + HMaterID;
            var dataSet = oCN.RunProcReturn(sql, "Gy_Material");
            var dataSet = oCn.RunProcReturn(sql, "Gy_Material");
            if (dataSet == null || dataSet.Tables[0].Rows.Count == 0)
@@ -541,7 +1064,7 @@
                ClsPub.CurUserName = user;
                BillOld.MvarItemKey = "Kf_ICStockBillMain";
                oCN.BeginTran();//开始事务
                oCn.BeginTran();//开始事务
                //Type 1 å®¡æ ¸  2  åå®¡æ ¸
                if (Type == 1)
@@ -549,7 +1072,7 @@
                    //判断单据是否已经审核
                    DataSet ds;
                    string sql = "select * from " + BillOld.MvarItemKey + " where HinterID = " + HInterID;
                    ds = oCN.RunProcReturn(sql, BillOld.MvarItemKey);
                    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() != "")
@@ -576,7 +1099,7 @@
                    //判断单据是否已经反审核
                    DataSet ds;
                    string sql = "select * from " + BillOld.MvarItemKey + " where HinterID = " + HInterID;
                    ds = oCN.RunProcReturn(sql, BillOld.MvarItemKey);
                    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() == "")
@@ -612,7 +1135,7 @@
                    }
                }
                oCN.Commit();//提交事务
                oCn.Commit();//提交事务
                objJsonResult.code = "0";
                objJsonResult.count = 1;
@@ -729,7 +1252,7 @@
                    //审核前控制=========================================      
                    string sql1 = "exec h_p_Kf_ProductInBill_BeforeCheckCtrl " + oBill.omodel.HInterID + ",'" + oBill.omodel.HBillNo + "','" + CurUserName + "'";
                    ds = oCN.RunProcReturn(sql1, "h_p_Kf_ProductInBill_BeforeCheckCtrl");
                    ds = oCn.RunProcReturn(sql1, "h_p_Kf_ProductInBill_BeforeCheckCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
@@ -770,7 +1293,7 @@
                if (IsAudit == 1) //反审核提交
                {
                    //反审核前控制=========================================
                    DataSet ds = oCN.RunProcReturn("Exec h_p_Kf_ProductInBill_BeforeUnCheckCtrl " + oBill.omodel.HInterID + ",'" + oBill.omodel.HBillNo + "','" + CurUserName + "'", "h_p_Kf_ProductInBill_BeforeUnCheckCtrl");
                    DataSet ds = oCn.RunProcReturn("Exec h_p_Kf_ProductInBill_BeforeUnCheckCtrl " + oBill.omodel.HInterID + ",'" + oBill.omodel.HBillNo + "','" + CurUserName + "'", "h_p_Kf_ProductInBill_BeforeUnCheckCtrl");
                    if (ds == null)
                    {
                        objJsonResult.code = "0";
@@ -848,7 +1371,7 @@
                ClsPub.CurUserName = user;
                BillOld.MvarItemKey = "Kf_ICStockBillMain";
                oCN.BeginTran();//开始事务
                oCn.BeginTran();//开始事务
                //Type 1 å…³é—­  2  åå…³é—­
                if (Type == 1)
@@ -856,7 +1379,7 @@
                    //判断单据是否已经关闭
                    DataSet ds;
                    string sql = "select * from " + BillOld.MvarItemKey + " where HinterID = " + HInterID;
                    ds = oCN.RunProcReturn(sql, BillOld.MvarItemKey);
                    ds = oCn.RunProcReturn(sql, BillOld.MvarItemKey);
                    if (ds == null || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
@@ -908,7 +1431,7 @@
                    //判断单据是否已经反关闭
                    DataSet ds;
                    string sql = "select * from " + BillOld.MvarItemKey + " where HinterID = " + HInterID;
                    ds = oCN.RunProcReturn(sql, BillOld.MvarItemKey);
                    ds = oCn.RunProcReturn(sql, BillOld.MvarItemKey);
                    if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0)
                    {
                        if (ds.Tables[0].Rows[0]["HDeleteMan"] != null && ds.Tables[0].Rows[0]["HDeleteMan"].ToString() != "")
@@ -947,7 +1470,7 @@
                    }
                }
                oCN.Commit();//提交事务
                oCn.Commit();//提交事务
                objJsonResult.code = "0";
                objJsonResult.count = 1;
@@ -995,7 +1518,7 @@
                ClsPub.CurUserName = user;
                BillOld.MvarItemKey = "Kf_ICStockBillMain";
                oCN.BeginTran();//开始事务
                oCn.BeginTran();//开始事务
                //Type 1 ä½œåºŸ  2  åä½œåºŸ
                if (Type == 1)
@@ -1003,7 +1526,7 @@
                    //判断单据是否已经作废
                    DataSet ds;
                    string sql = "select * from " + BillOld.MvarItemKey + " where HinterID = " + HInterID;
                    ds = oCN.RunProcReturn(sql, BillOld.MvarItemKey);
                    ds = oCn.RunProcReturn(sql, BillOld.MvarItemKey);
                    if (ds == null || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
@@ -1046,7 +1569,7 @@
                    //判断单据是否已经反作废
                    DataSet ds;
                    string sql = "select * from " + BillOld.MvarItemKey + " where HinterID = " + HInterID;
                    ds = oCN.RunProcReturn(sql, BillOld.MvarItemKey);
                    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() != "")
@@ -1077,7 +1600,7 @@
                    }
                }
                oCN.Commit();//提交事务
                oCn.Commit();//提交事务
                objJsonResult.code = "0";
                objJsonResult.count = 1;
WebAPI/Controllers/»ù´¡×ÊÁÏ/¹¤×Ê»ù´¡×ÊÁÏ/Gy_WorkTypeController.cs
@@ -40,7 +40,7 @@
        {
            try
            {
                //判断权限
                //判断权限  1为直接列表模块打开  2为从其他模块跳转打开列表
                if (OperationType == "1")
                {
                    //判断权限
WebAPI/Controllers/¹¤×ʹÜÀí/Pay_SingleBalBillController.cs
@@ -592,7 +592,231 @@
        }
        #endregion
        #region å·¥èµ„结算单(个人)模块   ä»Žåˆ—表选中打开单据,返回单据信息时调用
        /// <summary>
        /// å·¥èµ„结算单(个人)编辑时,根据单据ID获取单据信息
        /// </summary>
        /// <returns></returns>
        [Route("Pay_SingleBalBillController/GetPay_SingleBalBill_Json")]
        [HttpGet]
        public object GetPay_SingleBalBill_Json(Int64 HInterID, string HMaker)
        {
            try
            {
                //判断权限
                if (!DBUtility.ClsPub.Security_Log(ModRightNameEdit, 3, false, HMaker))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "您没有该模块编辑权限,请与管理员联系!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                //返回列表信息
                ds = oCn.RunProcReturn("exec h_p_Pay_SingleBalBill_EditInit " + HInterID, "h_p_Pay_SingleBalBill_EditInit");
                if (ds == null || ds.Tables[0].Rows.Count == 0)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "未查询到该工资结算单(个人),请刷新数据后重新选择!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                else
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "成功!";
                    objJsonResult.data = ds.Tables[0];
                    return objJsonResult;
                }
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "返回工资结算单(个人)信息失败!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
        #region å·¥èµ„结算单(个人)保存
        /// <summary>
        /// å·¥èµ„结算单(个人)保存
        /// </summary>
        [Route("Pay_SingleBalBillController/GetPay_SingleBalBill_Save_Json")]
        [HttpPost]
        public object GetPay_SingleBalBill_Save_Json([FromBody] JObject sMainSub)
        {
            var _value = sMainSub["sMainSub"].ToString();
            string msg1 = _value.ToString();
            string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
            string sMainStr = sArray[0].ToString();         //主表数据
            string sSubStr = sArray[1].ToString();          //子表数据
            string OperationType = sArray[2].ToString();    //操作类型(1新增、2编辑)
            string HMaker = sArray[3].ToString();           //制单人
            try
            {
                //判断权限
                if (OperationType == "1")
                {
                    BillStatus = DBUtility.ClsPub.Enum_BillStatus.BillStatus_AddNew;
                    //判断新增权限
                    if (!DBUtility.ClsPub.Security_Log(ModRightName, 1, false, HMaker))
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "您没有该模块新增权限,请与管理员联系!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                }
                else
                {
                    BillStatus = DBUtility.ClsPub.Enum_BillStatus.BillStatus_Modify;
                    //判断编辑权限
                    if (!DBUtility.ClsPub.Security_Log(ModRightNameEdit, 1, false, HMaker))
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "您没有该模块编辑权限,请与管理员联系!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                }
                //表头赋值
                sMainStr = sMainStr.Replace("\\", "");
                sMainStr = sMainStr.Replace("\n", "");
                sMainStr = "[" + sMainStr.ToString() + "]";
                List<Model.ClsPay_SingleBalBillMain> lsmain = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsPay_SingleBalBillMain>>(sMainStr);
                foreach (Model.ClsPay_SingleBalBillMain oItem in lsmain)
                {
                    //单据号是否重复
                    if (oBill.IsExistBillNo(ref ClsPub.sExeReturnInfo, oItem.HBillNo, BillStatus, oItem.HInterID))
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "单据号重复!不允许保存!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //判断会计期是否合理
                    string s = "";
                    int sYear = 0;
                    int sPeriod = 0;
                    if (DBUtility.Xt_BaseBillFun.Fun_AllowYearPeriod_Pay(oItem.HDate, ref sYear, ref sPeriod, ref s) == false)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = s;
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    oItem.HYear = sYear;
                    oItem.HPeriod = sPeriod;
                    DBUtility.ClsPub.CurUserName = oItem.HMaker;
                    oBill.omodel = oItem;
                }
                //表体赋值
                //按 },{来拆分数组 //去掉【和】
                sSubStr = sSubStr.Substring(1, sSubStr.Length - 2);
                sSubStr = sSubStr.Replace("\\", "");
                sSubStr = sSubStr.Replace("\n", "");
                sSubStr = "[" + sSubStr.ToString() + "]";
                List<Model.ClsPay_SingleBalBillSub> ls = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsPay_SingleBalBillSub>>(sSubStr);
                int i = 0;
                foreach (Model.ClsPay_SingleBalBillSub 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 = "0";
                    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;
                }
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "保存失败!" + e.Message;
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
        #region æ ¹æ®ç‰©æ–™ID、工序ID、资源ID获取工价
        [Route("Pay_SingleBalBill/get_HPrice_BaseMaterHProcHSource")]
        [HttpGet]
        public object get_HPrice_BaseMaterHProcHSource(Int64 HMaterID, Int64 HProcID, Int64 HSourceID)
        {
            try
            {
                DAL.ClsGy_ProcPrice_Ctl oProcPrice = new DAL.ClsGy_ProcPrice_Ctl();
                double HPrice = oProcPrice.LoadProcPrice(HMaterID, HProcID, HSourceID, true);
                objJsonResult.code = "1";
                objJsonResult.count = 1;
                objJsonResult.Message = "Sucess!";
                objJsonResult.data = HPrice;
                return objJsonResult;
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
        //---------------------------------------------------------------------------------------------旧方法
        #region å·¥èµ„结算单个人-查询
        /// <summary>
@@ -1375,33 +1599,6 @@
                    objJsonResult.data = null;
                    return objJsonResult;
                }
            }
        }
        #endregion
        #region æ ¹æ®ç‰©æ–™ID、工序ID、资源ID获取工价
        [Route("Pay_SingleBalBill/get_HPrice_BaseMaterHProcHSource")]
        [HttpGet]
        public object get_HPrice_BaseMaterHProcHSource(Int64 HMaterID, Int64 HProcID, Int64 HSourceID)
        {
            try
            {
                DAL.ClsGy_ProcPrice_Ctl oProcPrice = new DAL.ClsGy_ProcPrice_Ctl();
                double HPrice = oProcPrice.LoadProcPrice(HMaterID, HProcID, HSourceID, true);
                objJsonResult.code = "1";
                objJsonResult.count = 1;
                objJsonResult.Message = "Sucess!";
                objJsonResult.data = HPrice;
                return objJsonResult;
            }
            catch(Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
WebAPI/Web.config
@@ -22,7 +22,7 @@
        <!--<add key="FileIP" value="http://localhost:8082/LuBaoAPI"/>-->
        <!--<add key="FileIP" value="http://localhost:8080/" />-->
        <!--<add key="sUrl" value="http://183.129.128.86:9090/WEBS-WMSTest/WebService1.asmx"/>    -->
        <!--add key="sUrl" value="http://192.168.63.53/WEBS-WMS/WebService1.asmx"/>   é¢œå°å¼æœº-->
        <add key="sUrl" value="http://192.168.63.53/WEBS-WMS/WebService1.asmx"/>   <!--颜台式机-->
        <!--<add key="sUrl" value="http://60.190.4.42:9003/WebService/WebService1.asmx" /> å¤å®-->
        <!--<add key="sUrl" value="http://60.190.4.42:9003/WebService/WebService1.asmx" /> -->
        <!--<add key="sUrl" value="http://10.10.130.181/WEBS-WMS/WebService1.asmx"/>    åšæ—¥ç§‘技-->
@@ -34,7 +34,7 @@
        <!--<add key="sUrl" value="http://192.168.80.90:9090/WEBS-WMS/WebService1.asmx"/>     å®‰ç‘žæœåС噍-->
        <!--<add key="sUrl" value="http://47.96.97.237/WEBS-WMS/WebService1.asmx"/> -->    <!--测试服务器-->
        <!--<add key="sUrl" value="http://localhost:8082/WEBS/WebService1.asmx"/>    æœ¬åœ°-->
        <add key="sUrl" value="http://192.168.110.57:81/WEBS/WebService1.asmx"/>    <!--陈雯静本地配置-->
        <!--<add key="sUrl" value="http://192.168.110.57:81/WEBS/WebService1.asmx"/>    é™ˆé›¯é™æœ¬åœ°é…ç½®-->
        <!--<add key="sUrl" value="http://192.168.1.57:8082/WEBS-WMS/WebService1.asmx"/>九菱-->
        <add key="webpages:Version" value="3.0.0.0" />