杨乐
2022-01-19 fad12ab96ea63fe46e75d33e95754d032deddcdb
生产工序  完善
器具维修派工单 验证
设备维修派工单 编辑
5个文件已修改
4个文件已添加
1076 ■■■■■ 已修改文件
WebAPI/Controllers/LMESController.cs 17 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Controllers/SBGL/Sb_EquipRepairSendWorkBillController.cs 225 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Controllers/Sc_MouldRepairSendWorkBillController.cs 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Controllers/Sc_ProcessMangementController.cs 253 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/DLL/ClsSb_EquipRepairSendWorkBill.cs 229 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/DLL/ClsSc_ProcessPlan.cs 291 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Models/ClsSb_EquipRepairSendWorkBillMain.cs 23 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Models/ClsSb_EquipRepairSendWorkBillSub.cs 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/WebAPI.csproj 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Controllers/LMESController.cs
@@ -246,7 +246,7 @@
                    return objJsonResult;
                }
                oCN.BeginTran();//开始事务
                ds = oCN.RunProcReturn("select * from Gy_RoutingBillSub where HInterID=" + lngBillKey, "Gy_RoutingBillSub");
                ds = oCN.RunProcReturn("select * from Gy_RoutingBillmain where HInterID=" + lngBillKey, "Gy_RoutingBillmain");
                if (ds == null || ds.Tables[0].Rows.Count == 0)
                {
                    objJsonResult.code = "0";
@@ -255,12 +255,21 @@
                    objJsonResult.data = null;
                    return objJsonResult; ;
                }
                //string HChecker = Convert.ToString(ds.Tables[0].Rows[0]["HChecker"]);
                //if (HChecker != " ")
                string HChecker = Convert.ToString(ds.Tables[0].Rows[0]["HChecker"]);
                //string hdeleteman = Convert.ToString(ds.Tables[0].Rows[0]["hdeleteman"]);
                if (HChecker != "")
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "单据已经审核,不能删除!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                //if (hdeleteman != "")
                //{
                //    objJsonResult.code = "0";
                //    objJsonResult.count = 0;
                //    objJsonResult.Message = "单据已经审核,不能删除!";
                //    objJsonResult.Message = "单据已经作废,不能删除!";
                //    objJsonResult.data = null;
                //    return objJsonResult;
                //}
WebAPI/Controllers/SBGL/Sb_EquipRepairSendWorkBillController.cs
@@ -1,9 +1,11 @@
using System;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Http;
using WebAPI.DLL;
using WebAPI.Models;
namespace WebAPI.Controllers.SBGL
@@ -12,6 +14,9 @@
    {
        public DBUtility.ClsPub.Enum_BillStatus BillStatus;
        ClsSb_EquipRepairSendWorkBillMain omodel = new ClsSb_EquipRepairSendWorkBillMain();
        List<ClsSb_EquipRepairSendWorkBillSub> DetailColl = new List<ClsSb_EquipRepairSendWorkBillSub>();
        ClsSb_EquipRepairSendWorkBill oBill = new ClsSb_EquipRepairSendWorkBill();
        private json objJsonResult = new json();
        SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
        DataSet ds;
@@ -23,7 +28,7 @@
        {
            try
            {
                string sql = "select * from  h_v_Sb_EquipRepairSendWorkBillList ";
                string sql = "select * from  h_v_Sb_EquipRepairSendWorkBillList where 1=1 ";
                if (sWhere == "" || sWhere == null)
                {
                    ds = oCN.RunProcReturn(sql, "h_v_Sb_EquipRepairSendWorkBillList");
@@ -59,6 +64,222 @@
        #endregion
        #region 设备维修派工单 添加/修改
        [Route("Sb_EquipRepairSendWorkBill/AddEquipRepairSendWorkBill")]
        [HttpPost]
        public object AddBill([FromBody] JObject sMainSub)
        {
            var _value = sMainSub["sMainSub"].ToString();
            string msg1 = _value.ToString();
            oCN.BeginTran();
            //保存主表
            objJsonResult = AddBillMain(msg1);
            if (objJsonResult.code == "0")
            {
                oCN.RollBack();
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = objJsonResult.Message;
                objJsonResult.data = null;
                return objJsonResult;
            }
            oCN.Commit();
            objJsonResult.code = "1";
            objJsonResult.count = 1;
            objJsonResult.Message = "新增单据成功!";
            objJsonResult.data = null;
            return objJsonResult;
        }
        public json AddBillMain(string msg1)
        {
            string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
            string msg2 = sArray[0].ToString();
            string msg3 = sArray[1].ToString();
            int hentryid = int.Parse(sArray[2].ToString());//子表的顺序id
            int OperationType = int.Parse(sArray[3].ToString());//数据类型 1添加 3修改
            try
            {
                omodel = Newtonsoft.Json.JsonConvert.DeserializeObject<ClsSb_EquipRepairSendWorkBillMain>(msg2);
                string BillType = "3909";
                if (OperationType == 1)//新增
                {
                    //主表
                    oCN.RunProc("Insert Into Sb_EquipRepairSendWorkBillMain" +
               "(HBillType,HBillSubType,HInterID,HBillNo,HDate" +
              ",HYear,HPeriod,HRemark,HMaker,HMakeDate" +
              ",HEquipID,HExplanation,HInnerBillNo,HRepairID,HEmpID" +
              ",HManagerID,HDeptID,HRepairContent,HRepairPlanBeginDate,HRepairPlanEndDate" +
              ",HPlanTimes,HCycleUnit" +
              ") " +
              " values('" + BillType + "','" + BillType + "'," + omodel.HInterID.ToString() + ",'" + omodel.HBillNo + "','" + omodel.HDate + "'" +
              ", " + omodel.HYear.ToString() + "," + omodel.HPeriod.ToString() + ",'" + omodel.HRemark + "','" + omodel.HMaker + "',getdate()" +
              ", " + omodel.HEquipID.ToString() + ",'" + omodel.HExplanation + "','" + omodel.HInnerBillNo + "'," + omodel.HRepairID.ToString() + "," + omodel.HEmpID.ToString() +
              "," + omodel.HManagerID.ToString() + "," + omodel.HDeptID.ToString() + ",'" + omodel.HRepairContent + "','" + omodel.HRepairPlanBeginDate + "','" + omodel.HRepairPlanEndDate + "'" +
              "," + omodel.HPlanTimes.ToString() + ",'" + omodel.HCycleUnit + "'" +
              ") ");
                }
                else if (OperationType == 3)
                {
                    //修改
                    oCN.RunProc("UpDate Sb_EquipRepairSendWorkBillMain set  " +
                    "HDate='" + omodel.HDate + "'" +
                    ",HYear='" + omodel.HYear.ToString() + "'" +
                    ",HPeriod='" + omodel.HPeriod.ToString() + "'" +
                    ",HRemark='" + omodel.HRemark + "'" +
                    ",HUpDater='" + omodel.HUpDater + "'" +
                    ",HUpDateDate=getdate()" +
                    //=========================================
                    ",HEquipID=" + omodel.HEquipID.ToString() +
                    ",HRepairID=" + omodel.HRepairID.ToString() +
                    ",HPlanTimes=" + omodel.HPlanTimes.ToString() +
                    ",HEmpID=" + omodel.HEmpID.ToString() +
                    ",HManagerID=" + omodel.HManagerID.ToString() +
                    ",HDeptID=" + omodel.HDeptID.ToString() +
                    ",HRepairPlanBeginDate='" + omodel.HRepairPlanBeginDate + "'" +
                    ",HRepairPlanEndDate='" + omodel.HRepairPlanEndDate + "'" +
                    ",HRepairContent='" + omodel.HRepairContent + "'" +
                    ",HCycleUnit='" + omodel.HCycleUnit + "'" +
                    ",HExplanation='" + omodel.HExplanation + "'" +
                    ",HInnerBillNo='" + omodel.HInnerBillNo + "'" +
                    " where HInterID=" + omodel.HInterID);
                    //删除子表
                    oCN.RunProc("delete from Sb_EquipRepairSendWorkBillSub where HInterID='" + omodel.HInterID + "' and HEntryID='" + hentryid + "'");
                }
                //保存子表
                objJsonResult = AddBillSub(msg3, hentryid);
                if (objJsonResult.code == "0")
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = objJsonResult.Message;
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                objJsonResult.code = "1";
                objJsonResult.count = 1;
                objJsonResult.Message = null;
                objJsonResult.data = null;
                return objJsonResult;
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "Exception!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        public json AddBillSub(string msg3, int hentryid)
        {
            DetailColl = Newtonsoft.Json.JsonConvert.DeserializeObject<List<ClsSb_EquipRepairSendWorkBillSub>>(msg3);
            int i = 1;
            //插入子表
            foreach (Models.ClsSb_EquipRepairSendWorkBillSub oSub in DetailColl)
            {
                oCN.RunProc("Insert into Sb_EquipRepairSendWorkBillSub " +
                       " (HInterID,HEntryID,HCloseMan,HEntryCloseDate,HCloseType,HRemark" +
                       ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" +
                       ",HRepairID,HManagerID,HRepairExplanation" +
                       ") values("
                       + omodel.HInterID.ToString() + "," + (hentryid==-1?i: hentryid) + ",'" + 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.HRepairID.ToString() + "," + oSub.HManagerID.ToString() + ",'" + oSub.HRepairExplanation + "'" +
                       ") ");
                i++;
            }
            objJsonResult.code = "1";
            objJsonResult.count = 1;
            objJsonResult.Message = null;
            objJsonResult.data = null;
            return objJsonResult;
        }
        #endregion
        #region 设备维修派工单 删除
        [Route("Sb_EquipRepairSendWorkBill/DeleteWorkBill")]
        [HttpGet]
        public object MouldDeleteBill(long HInterID, string User, string ModRightNameDelete)
        {
            try
            {
                //判断权限
                //if (!DBUtility.ClsPub.Security_Log(ModRightNameDelete, 1, false, User))
                //{
                //    objJsonResult.code = "0";
                //    objJsonResult.count = 0;
                //    objJsonResult.Message = "没有删除权限";
                //    objJsonResult.data = null;
                //    return objJsonResult;
                //}
                oBill.ShowBill(HInterID, ref DBUtility.ClsPub.sExeReturnInfo);
                if (oBill.omodel.HBillStatus > 1)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "单据当前处于不能删除的状态";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                if (oBill.omodel.HCloseMan != "")
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "单据当前已关闭,不能删除";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                if (oBill.omodel.HDeleteMan != "")
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "单据当前已作废,不能删除";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                if (oBill.omodel.HChecker != "")
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "单据当前已审核";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                if (oBill.DeleteBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo))
                {
                    objJsonResult.code = "1";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "删除成功";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                else
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "删除失败";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "无权限删除";
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
    }
}
WebAPI/Controllers/Sc_MouldRepairSendWorkBillController.cs
@@ -248,14 +248,15 @@
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                if (oBill.omodel.HChecker != "")
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "单据当前已审核";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                //不需要
                //if (oBill.omodel.HChecker != "")
                //{
                //    objJsonResult.code = "0";
                //    objJsonResult.count = 1;
                //    objJsonResult.Message = "单据当前已审核";
                //    objJsonResult.data = null;
                //    return objJsonResult;
                //}
                if (oBill.DeleteBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo))
                {
                    objJsonResult.code = "1";
@@ -313,6 +314,7 @@
                    return objJsonResult;
                }
                //转换id
                Int64 lngBillKey = 0;
                lngBillKey = DBUtility.ClsPub.isLong(HInterID);
WebAPI/Controllers/Sc_ProcessMangementController.cs
@@ -6,6 +6,7 @@
using System.Data;
using System.Data.SqlClient;
using System.Web.Http;
using WebAPI.DLL;
using WebAPI.Models;
using WebAPI.Service;
@@ -223,10 +224,11 @@
        }
        #region 工序计划单
        #region 工序计划单列表
        List<ClsSc_ProcessPlanSub> DetailColl = new List<ClsSc_ProcessPlanSub>();
        ClsSc_ProcessPlanMain omodel = new ClsSc_ProcessPlanMain();
        ClsSc_ProcessPlan oBill = new ClsSc_ProcessPlan();
        #region 工序计划单列表
        /// <summary>
        /// 返回生产工序计划单列表
        ///参数:string sql。
@@ -316,7 +318,7 @@
                    ",HRemark,HInnerBillNo,HMaker,HMakeDate" +
                    ") " +
                    " values(" + omodel.HYear.ToString() + "," + omodel.HPeriod.ToString() + ",'" + BillType + "','" + BillType + "'," + omodel.HInterID.ToString() +
                    ",'" + omodel.HDate.ToShortDateString() + "','" + omodel.HBillNo + "'," + omodel.HBillStatus.ToString() + "," + omodel.HCheckItemNowID.ToString() + "," + omodel.HCheckItemNextID.ToString() +
                    ",'" + omodel.HDate.ToShortDateString() + "','" + omodel.HBillNo + "'," + (omodel.HBillStatus=1) + "," + omodel.HCheckItemNowID.ToString() + "," + omodel.HCheckItemNextID.ToString() +
                    "," + omodel.HICMOInterID.ToString() + ",'" + omodel.HICMOBillNo + "'," + omodel.HMaterID.ToString() + ",'" + omodel.HMaterNumber + "'," + omodel.HUnitID.ToString() +
                    ",'" + omodel.HUnitNumber + "'," + omodel.HPlanQty.ToString() + ",'" + omodel.HPlanBeginDate.ToShortDateString() + "','" + omodel.HPlanEndDate.ToShortDateString() + "','" + omodel.HExplanation + "'" +
                    ",'" + omodel.HRemark + "','" + omodel.HInnerBillNo + "','" + omodel.HMaker + "',getdate()" +
@@ -419,6 +421,251 @@
        }
        #endregion
        #region 审核/反审核
        [Route("Sc_ProcessMangement/CheckDeOAuditBill")]
        [HttpGet]
        public object CheckDeOAuditBill(int HInterID, int IsAudit, string CurUserName)
        {
            //    string ModRightNameCheck = ""; 该模块的审核功能
            DBUtility.ClsPub.CurUserName = CurUserName;//存储用户名
            try
            {
                ////判断是否有审核权限
                //    if (!DBUtility.ClsPub.Security_Log(ModRightNameCheck, 1, false, CurUserName))
                //{
                //    objJsonResult.code = "0";
                //    objJsonResult.count = 0;
                //    objJsonResult.Message = "审核失败!无权限!";
                //    objJsonResult.data = null;
                //    return objJsonResult;
                //}
                //判断id是否大于0
                if (HInterID <= 0)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "ID小于0";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                //转换id
                Int64 lngBillKey = 0;
                lngBillKey = DBUtility.ClsPub.isLong(HInterID);
                //查询审核的这条数据
                ds = oCN.RunProcReturn("select * from Sc_ProcessPlanMain where HInterID='" + HInterID + "'", "Sc_ProcessPlanMain");
                if (ds.Tables[0].Rows.Count > 0)
                {
                    string HCloseMan = ds.Tables[0].Rows[0]["HCloseMan"].ToString().Trim();//关闭人
                    string HDeleteMan = ds.Tables[0].Rows[0]["HDeleteMan"].ToString().Trim();//作废人
                    string HChecker = ds.Tables[0].Rows[0]["HChecker"].ToString().Trim();//审核人
                    if (HCloseMan != "")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "当前单据已关闭,不能审核";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (HDeleteMan != "")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "当前单据已作废,不能审核";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //IsAudit==0  审核
                    if (IsAudit == 0)
                    {
                        if (HChecker != "")
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "当前数据已审核";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                    }
                    //IsAudit==1  反审核
                    if (IsAudit == 1)
                    {
                        if (HChecker == "")
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "当前数据未审核";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                    }
                }
                else
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "单据不存在;原因:"+DBUtility.ClsPub.sExeReturnInfo;
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                //审核提交
                if (IsAudit == 0)
                {
                    if (CheckBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo))
                    {
                        objJsonResult.code = "1";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "审核成功";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    else {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "审核失败,原因:" + DBUtility.ClsPub.sExeReturnInfo;
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                }
                //反审核提交
                if (IsAudit == 1)
                {
                    if (AbandonCheck(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo))
                    {
                        objJsonResult.code = "1";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反审核成功";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    else
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "反审核失败,原因:" + DBUtility.ClsPub.sExeReturnInfo;
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                }
                return objJsonResult;
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "审核失败或反审核失败" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        //审核
        public bool CheckBill(Int64 lngBillKey, ref string sReturn)
        {
            try
            {
                string HChecker = DBUtility.ClsPub.CurUserName;//用户名
                oCN.BeginTran();//打开事务
                oCN.RunProc("update Sc_ProcessPlanMain set HChecker='" + HChecker + "',HCheckDate='" + DateTime.Now + "',HBillStatus=2 where HInterID='" + lngBillKey + "'");
                oCN.Commit();//关闭事务
                sReturn = "审核单据成功!";
                return true;
            }
            catch (Exception e)
            {
                sReturn = e.Message;
                throw (e);
            }
        }
        //反审核
        public bool AbandonCheck(Int64 lngBillKey, ref string sReturn)
        {
            try
            {
                string HChecker = DBUtility.ClsPub.CurUserName;//用户名
                oCN.BeginTran();//打开事务
                oCN.RunProc("update Sc_ProcessPlanMain set HChecker='',HCheckDate=null,HBillStatus=1 where HInterID='" + lngBillKey + "'");
                oCN.Commit();//关闭事务
                sReturn = "反审核单据成功!";
                return true;
            }
            catch (Exception e)
            {
                sReturn = e.Message;
                throw (e);
            }
        }
        #endregion
        #region 删除
        [Route("Sc_ProcessMangement/DeleteProcessBill")]
        [HttpGet]
        public object MouldDeleteBill(long HInterID, string User, string ModRightNameDelete)
        {
            try
            {
                //判断权限
                //if (!DBUtility.ClsPub.Security_Log(ModRightNameDelete, 1, false, User))
                //{
                //    objJsonResult.code = "0";
                //    objJsonResult.count = 0;
                //    objJsonResult.Message = "没有删除权限";
                //    objJsonResult.data = null;
                //    return objJsonResult;
                //}
                oBill.ShowBill(HInterID, ref DBUtility.ClsPub.sExeReturnInfo);
                if (oBill.omodel.HBillStatus > 1)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "单据当前处于不能删除的状态";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                //不需要
                //if (oBill.omodel.HChecker != "")
                //{
                //    objJsonResult.code = "0";
                //    objJsonResult.count = 1;
                //    objJsonResult.Message = "单据当前已审核";
                //    objJsonResult.data = null;
                //    return objJsonResult;
                //}
                if (oBill.DeleteBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo))
                {
                    objJsonResult.code = "1";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "删除成功";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                else
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "删除失败";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "无权限删除";
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
        #endregion
        /// <summary>
        /// 返回生产工序派工单列表
WebAPI/DLL/ClsSb_EquipRepairSendWorkBill.cs
New file
@@ -0,0 +1,229 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
namespace WebAPI.DLL
{
    public class ClsSb_EquipRepairSendWorkBill : DBUtility.ClsXt_BaseBill
    {
        public Models.ClsSb_EquipRepairSendWorkBillMain omodel = new Models.ClsSb_EquipRepairSendWorkBillMain();
        public List<Models.ClsSb_EquipRepairSendWorkBillSub> DetailColl = new List<Models.ClsSb_EquipRepairSendWorkBillSub>();
        public ClsSb_EquipRepairSendWorkBill()
        {
            base.MvarItemKeySub = "Sb_EquipRepairSendWorkBillSub";
            base.MvarItemKeySub2 = "";
            base.MvarItemKeySub3 = "";
            base.MvarItemKeySub4 = "";
            base.MvarItemKey = "Sb_EquipRepairSendWorkBillMain";
            base.MvarReportTitle = "设备维修派工单";
            base.BillType = "3909";
        }
        #region 固定代码
        ~ClsSb_EquipRepairSendWorkBill()
        {
            DetailColl = null;
        }
        #endregion   自定义方法
        //修改单据
        public override bool ModifyBill(Int64 lngBillKey, ref string sReturn)
        {
            try
            {
                //
                oCn.BeginTran();
                //更新主表
                oCn.RunProc("UpDate Sb_EquipRepairSendWorkBillMain set  " +
                " HBillNo='" + omodel.HBillNo + "'" +  //固定赋值===============
                ",HDate='" + omodel.HDate + "'" +
                ",HYear='" + omodel.HYear.ToString() + "'" +
                ",HPeriod='" + omodel.HPeriod.ToString() + "'" +
                ",HRemark='" + omodel.HRemark + "'" +
                ",HUpDater='" + DBUtility.ClsPub.CurUserName + "'" +
                ",HUpDateDate=getdate()" +
                //=========================================
                ",HEquipID=" + omodel.HEquipID.ToString() +
                ",HRepairID=" + omodel.HRepairID.ToString() +
                ",HPlanTimes=" + omodel.HPlanTimes.ToString() +
                ",HEmpID=" + omodel.HEmpID.ToString() +
                ",HManagerID=" + omodel.HManagerID.ToString() +
                ",HDeptID=" + omodel.HDeptID.ToString() +
                ",HRepairPlanBeginDate='" + omodel.HRepairPlanBeginDate + "'" +
                ",HRepairPlanEndDate='" + omodel.HRepairPlanEndDate + "'" +
                ",HRepairContent='" + omodel.HRepairContent + "'" +
                ",HCycleUnit='" + omodel.HCycleUnit + "'" +
                ",HExplanation='" + omodel.HExplanation + "'" +
                ",HInnerBillNo='" + omodel.HInnerBillNo + "'" +
                " where HInterID=" + lngBillKey.ToString());
                //删除关联
                //DeleteRelation(ref sReturn, lngBillKey);
                ////删除子表
                DeleteBillSub(lngBillKey);
                ////插入子表
                omodel.HInterID = lngBillKey;
                foreach (Models.ClsSb_EquipRepairSendWorkBillSub oSub in DetailColl)
                {
                    oCn.RunProc("Insert into Sb_EquipRepairSendWorkBillSub " +
                      " (HInterID,HEntryID,HCloseMan,HEntryCloseDate,HCloseType,HRemark" +
                      ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" +
                      ",HRepairID,HManagerID,HRepairExplanation" +
                      ") 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.HRepairID.ToString() + "," + oSub.HManagerID.ToString() + ",'" + oSub.HRepairExplanation + "'" +
                      ") ");
                }
                sReturn = "修改单据成功!";
                oCn.Commit();
                return true;
            }
            catch (Exception e)
            {
                sReturn = e.Message;
                oCn.RollBack();
                throw (e);
            }
        }
        //新增单据
        public override bool AddBill(ref string sReturn)
        {
            try
            {
                //得到mainid
                omodel.HInterID = DBUtility.ClsPub.CreateBillID(BillType, ref DBUtility.ClsPub.sExeReturnInfo);
                //若MAINDI重复则重新获取
                oCn.BeginTran();
                //主表
                oCn.RunProc("Insert Into Sb_EquipRepairSendWorkBillMain" +
                 "(HBillType,HBillSubType,HInterID,HBillNo,HDate" +
                ",HYear,HPeriod,HRemark,HMaker,HMakeDate" +
                ",HEquipID,HExplanation,HInnerBillNo,HRepairID,HEmpID" +
                ",HManagerID,HDeptID,HRepairContent,HRepairPlanBeginDate,HRepairPlanEndDate" +
                ",HPlanTimes,HCycleUnit" +
                ") " +
                " values('" + this.BillType + "','" + this.HBillSubType + "'," + omodel.HInterID.ToString() + ",'" + omodel.HBillNo + "','" + omodel.HDate + "'" +
                ", " + omodel.HYear.ToString() + "," + omodel.HPeriod.ToString() + ",'" + omodel.HRemark + "','" + DBUtility.ClsPub.CurUserName + "',getdate()" +
                ", " + omodel.HEquipID.ToString() + ",'" + omodel.HExplanation + "','" + omodel.HInnerBillNo + "'," + omodel.HRepairID.ToString() + "," + omodel.HEmpID.ToString() +
                "," + omodel.HManagerID.ToString() + "," + omodel.HDeptID.ToString() + ",'" + omodel.HRepairContent + "','" + omodel.HRepairPlanBeginDate + "','" + omodel.HRepairPlanEndDate + "'" +
                "," + omodel.HPlanTimes.ToString() + ",'" + omodel.HCycleUnit + "'" +
                ") ");
                ////插入子表
                foreach (Models.ClsSb_EquipRepairSendWorkBillSub oSub in DetailColl)
                {
                    oCn.RunProc("Insert into Sb_EquipRepairSendWorkBillSub " +
                      " (HInterID,HEntryID,HCloseMan,HEntryCloseDate,HCloseType,HRemark" +
                      ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" +
                      ",HRepairID,HManagerID,HRepairExplanation" +
                      ") 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.HRepairID.ToString() + "," + oSub.HManagerID.ToString() + ",'" + oSub.HRepairExplanation + "'" +
                      ") ");
                }
                sReturn = "新增单据成功!";
                oCn.Commit();
                return true;
            }
            catch (Exception e)
            {
                sReturn = e.Message;
                oCn.RollBack();
                throw (e);
            }
        }
        //显示单据
        public override bool ShowBill(Int64 lngBillKey, ref string sReturn)
        {
            try
            {
                //查询主表
                DataSet Ds;
                Ds = oCn.RunProcReturn("Select * from Sb_EquipRepairSendWorkBillMain Where HInterID=" + lngBillKey.ToString(), "Sb_EquipRepairSendWorkBillMain");
                if (Ds.Tables[0].Rows.Count == 0)
                {
                    sReturn = "单据未找到!";
                    return false;
                }
                //赋值
                omodel.HYear = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HYear"]);
                omodel.HPeriod = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HPeriod"]);
                omodel.HBillType = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBillType"]);
                omodel.HBillSubType = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBillSubType"]);
                omodel.HInterID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HInterID"]);
                omodel.HDate = DBUtility.ClsPub.isDate(Ds.Tables[0].Rows[0]["HDate"]);
                omodel.HBillNo = Ds.Tables[0].Rows[0]["HBillNo"].ToString().Trim();
                omodel.HBillStatus = DBUtility.ClsPub.isInt(Ds.Tables[0].Rows[0]["HBillStatus"]);
                omodel.HCheckItemNowID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HCheckItemNowID"]);
                omodel.HCheckItemNextID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HCheckItemNextID"]);
                omodel.HCheckFlowID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HCheckFlowID"]);
                omodel.HRemark = Ds.Tables[0].Rows[0]["HRemark"].ToString().Trim();
                omodel.HBackDate = Ds.Tables[0].Rows[0]["HBackDate"].ToString().Trim();
                omodel.HBacker = Ds.Tables[0].Rows[0]["HBacker"].ToString().Trim();
                omodel.HCheckDate = Ds.Tables[0].Rows[0]["HCheckDate"].ToString().Trim();
                omodel.HChecker = Ds.Tables[0].Rows[0]["HChecker"].ToString().Trim();
                omodel.HMaker = Ds.Tables[0].Rows[0]["HMaker"].ToString().Trim();
                omodel.HMakeDate = Ds.Tables[0].Rows[0]["HMakeDate"].ToString().Trim();
                omodel.HUpDateDate = Ds.Tables[0].Rows[0]["HUpDateDate"].ToString().Trim();
                omodel.HUpDater = Ds.Tables[0].Rows[0]["HUpDater"].ToString().Trim();
                omodel.HCloseDate = Ds.Tables[0].Rows[0]["HCloseDate"].ToString().Trim();
                omodel.HCloseMan = Ds.Tables[0].Rows[0]["HCloseMan"].ToString().Trim();
                omodel.HCloseType = DBUtility.ClsPub.isBool(Ds.Tables[0].Rows[0]["HCloseType"]);
                omodel.HDeleteDate = Ds.Tables[0].Rows[0]["HDeleteDate"].ToString().Trim();
                omodel.HDeleteMan = Ds.Tables[0].Rows[0]["HDeleteMan"].ToString().Trim();
                //=======================================
                omodel.HEquipID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HEquipID"]);
                omodel.HRepairID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HRepairID"]);
                omodel.HEmpID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HEmpID"]);
                omodel.HPlanTimes = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HPlanTimes"]);
                omodel.HManagerID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HManagerID"]);
                omodel.HRepairPlanBeginDate = DBUtility.ClsPub.isDate(Ds.Tables[0].Rows[0]["HRepairPlanBeginDate"]);
                omodel.HRepairPlanEndDate = DBUtility.ClsPub.isDate(Ds.Tables[0].Rows[0]["HRepairPlanEndDate"]);
                omodel.HDeptID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HDeptID"]);
                omodel.HRepairContent = Ds.Tables[0].Rows[0]["HRepairContent"].ToString().Trim();
                omodel.HCycleUnit = Ds.Tables[0].Rows[0]["HCycleUnit"].ToString().Trim();
                omodel.HExplanation = Ds.Tables[0].Rows[0]["HExplanation"].ToString().Trim();
                omodel.HInnerBillNo = Ds.Tables[0].Rows[0]["HInnerBillNo"].ToString().Trim();
                //循环
                DataSet DsSub;
                DsSub = oCn.RunProcReturn("Select * from Sb_EquipRepairSendWorkBillSub Where HInterID=" + lngBillKey.ToString() + " order by HEntryID ", "Sb_EquipRepairSendWorkBillSub");
                DetailColl.Clear();//清空
                for (int i = 0; i < DsSub.Tables[0].Rows.Count; i++)
                {
                    Models.ClsSb_EquipRepairSendWorkBillSub oSub = new Models.ClsSb_EquipRepairSendWorkBillSub();
                    // 固定赋值===============================================
                    oSub.HInterID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HInterID"]);
                    oSub.HEntryID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HEntryID"]);
                    oSub.HSourceInterID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSourceInterID"]);
                    oSub.HSourceEntryID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSourceEntryID"]);
                    oSub.HSourceBillType = DsSub.Tables[0].Rows[i]["HSourceBillType"].ToString().Trim();
                    oSub.HSourceBillNo = DsSub.Tables[0].Rows[i]["HSourceBillNo"].ToString().Trim();
                    oSub.HRelationQty = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HRelationQty"]);
                    oSub.HRelationMoney = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HRelationMoney"]);
                    oSub.HCloseMan = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HCloseMan"]);
                    oSub.HCloseType = DBUtility.ClsPub.isBool(DsSub.Tables[0].Rows[i]["HCloseType"]);
                    oSub.HEntryCloseDate = DBUtility.ClsPub.isDate(DsSub.Tables[0].Rows[i]["HEntryCloseDate"]);
                    oSub.HRemark = DsSub.Tables[0].Rows[i]["HRemark"].ToString().Trim();
                    //===========================================
                    oSub.HRepairID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HRepairID"]);
                    oSub.HRepairExplanation = DsSub.Tables[0].Rows[i]["HRepairExplanation"].ToString().Trim();
                    oSub.HManagerID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HManagerID"]);
                    DetailColl.Add(oSub);
                }
                sReturn = "显示单据成功!";
                return true;
            }
            catch (Exception e)
            {
                sReturn = e.Message;
                throw (e);
            }
        }
    }
}
WebAPI/DLL/ClsSc_ProcessPlan.cs
New file
@@ -0,0 +1,291 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
namespace WebAPI.DLL
{
    public  class ClsSc_ProcessPlan:DBUtility.ClsXt_BaseBill
    {
        public Models.ClsSc_ProcessPlanMain omodel = new Models.ClsSc_ProcessPlanMain();
        public List<Models.ClsSc_ProcessPlanSub> DetailColl = new List<Models.ClsSc_ProcessPlanSub>();
        public ClsSc_ProcessPlan()
        {
            base.MvarItemKeySub = "Sc_ProcessPlanSub";
            base.MvarItemKeySub2 = "";
            base.MvarItemKeySub3 = "";
            base.MvarItemKeySub4 = "";
            base.MvarItemKey="Sc_ProcessPlanMain";
            base.MvarReportTitle="工序计划单";
            base.BillType="3715";
        }
        #region 固定代码
        ~ClsSc_ProcessPlan()
        {
            DetailColl = null;
        }
        #endregion   自定义方法
        //删除
        public bool DeleteBill2(Int64 lngBillKey, ref string sReturn)
        {
            oK3Cn.RunProc("update ICMO set FCardClosed=1059 where finterid=" + lngBillKey.ToString());
            return true;
        }
        //修改单据
        public override bool ModifyBill(Int64 lngBillKey, ref string sReturn)
        {
            try
            {
                //
                oCn.BeginTran();
                //更新主表
                oCn.RunProc("UpDate Sc_ProcessPlanMain set  " +
                " HYear=" + omodel.HYear.ToString() +
                ",HPeriod=" + omodel.HPeriod.ToString() +
                ",HInterID=" + omodel.HInterID.ToString() +
                ",HDate='" + omodel.HDate.ToShortDateString() + "'" +
                ",HBillNo='" + omodel.HBillNo + "'" +
                ",HBillStatus=" + omodel.HBillStatus.ToString() +
                ",HCheckItemNowID=" + omodel.HCheckItemNowID.ToString() +
                ",HCheckItemNextID=" + omodel.HCheckItemNextID.ToString() +
                ",HICMOInterID=" + omodel.HICMOInterID.ToString() +
                ",HICMOBillNo='" + omodel.HICMOBillNo + "'" +
                ",HMaterID=" + omodel.HMaterID.ToString() +
                ",HMaterNumber='" + omodel.HMaterNumber + "'" +
                ",HUnitID=" + omodel.HUnitID.ToString() +
                ",HUnitNumber='" + omodel.HUnitNumber + "'" +
                ",HPlanQty=" + omodel.HPlanQty.ToString() +
                ",HPlanBeginDate='" + omodel.HPlanBeginDate.ToShortDateString() + "'" +
                ",HPlanEndDate='" + omodel.HPlanEndDate.ToShortDateString() + "'" +
                ",HExplanation='" + omodel.HExplanation + "'" +
                ",HRemark='" + omodel.HRemark + "'" +
                ",HInnerBillNo='" + omodel.HInnerBillNo + "'" +
                ",HUpDater='" + DBUtility.ClsPub.CurUserName + "'" +
                ",HUpDateDate=getdate()" +
                " where HInterID=" + lngBillKey.ToString());
                //删除关联
                DeleteRelation(ref sReturn, lngBillKey);
                //删除子表
                DeleteBillSub(lngBillKey);
                //插入子表
                omodel.HInterID = lngBillKey;
                foreach (Models.ClsSc_ProcessPlanSub oSub in DetailColl)
                {
                    oCn.RunProc("Insert into Sc_ProcessPlanSub " +
                  " (HInterID,HEntryID,HBillNo,HProcNo,HProcID,HWorkingQty" +
                  ",HProcNumber,HWorkRemark,HCenterID,HDeptID,HDeptNumber" +
                  ",HGroupID,HGroupNumber,HWorkerID,HWorkerNumber,HSourceID" +
                  ",HQty,HTimeUnit,HPlanWorkTimes,HPlanBeginDate,HPlanEndDate" +
                  ",HICMOInterID,HICMOBillNo,HSeOrderInterID,HSeOrderEntryID,HSeOrderBillNo" +
                  ",HCloseMan,HCloseType,HRemark,HSourceInterID,HSourceEntryID" +
                  ",HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" +
                  ",HBeginDayQty,HBeginFixQty,HFixWorkDays,HTrunWorkDays,HReadyTimes" +
                  ",HReadyTime,HQueueTime,HMoveTime,HBatchNo" +
                  ") values("
                  + omodel.HInterID.ToString() + "," + oSub.HEntryID.ToString() + ",'" + oSub.HBillNo + "'," + oSub.HProcNo.ToString() + "," + oSub.HProcID.ToString() + "," + oSub.HWorkingQty.ToString() +
                  ",'" + oSub.HProcNumber + "','" + oSub.HWorkRemark + "'," + oSub.HCenterID.ToString() +  "," + oSub.HDeptID.ToString()  + ",'" + oSub.HDeptNumber + "'" +
                  "," + oSub.HGroupID.ToString() + ",'" + oSub.HGroupNumber + "'," + oSub.HWorkerID.ToString() + ",'" + oSub.HWorkerNumber + "'," + oSub.HSourceID.ToString() +
                  "," + oSub.HQty.ToString() + ",'" + oSub.HTimeUnit + "'," + oSub.HPlanWorkTimes.ToString() + ",'" + oSub.HPlanBeginDate + "','" + oSub.HPlanEndDate +"'"+
                  "," + oSub.HICMOInterID.ToString() + ",'" + oSub.HICMOBillNo + "'," + oSub.HSeOrderInterID.ToString() + "," + oSub.HSeOrderEntryID.ToString() + ",'" + oSub.HSeOrderBillNo +"'"+
                  ",'" + oSub.HCloseMan + "'," + 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.HBeginDayQty.ToString() + "," + oSub.HBeginFixQty.ToString() + "," + oSub.HFixWorkDays.ToString() + "," + oSub.HTrunWorkDays.ToString() + "," + oSub.HReadyTimes.ToString() +
                  "," + oSub.HReadyTime.ToString() + "," + oSub.HQueueTime.ToString() + "," + oSub.HMoveTime.ToString() + ",'" + oSub.HBatchNo + "'" +
                  ") ");
                }
                sReturn = "修改单据成功!";
                oCn.Commit();
                return true;
            }
            catch (Exception e)
            {
                sReturn = e.Message;
                oCn.RollBack();
                throw (e);
            }
        }
        //新增单据
        public override bool AddBill(ref string sReturn)
        {
            try
            {
                //得到mainid
                omodel.HInterID = DBUtility.ClsPub.CreateBillID(BillType, ref DBUtility.ClsPub.sExeReturnInfo);
                //若MAINDI重复则重新获取
                oCn.BeginTran();
                //主表
                oCn.RunProc("Insert Into Sc_ProcessPlanMain   " +
                "(HYear,HPeriod,HBillType,HBillSubType,HInterID" +
                ",HDate,HBillNo,HBillStatus,HCheckItemNowID,HCheckItemNextID" +
                ",HICMOInterID,HICMOBillNo,HMaterID,HMaterNumber,HUnitID" +
                ",HUnitNumber,HPlanQty,HPlanBeginDate,HPlanEndDate,HExplanation" +
                ",HRemark,HInnerBillNo,HMaker,HMakeDate" +
                ") " +
                " values(" + omodel.HYear.ToString() + "," + omodel.HPeriod.ToString() + ",'" + this.BillType + "','" + omodel.HBillSubType + "'," + omodel.HInterID.ToString() +
                ",'" + omodel.HDate.ToShortDateString() + "','" + omodel.HBillNo + "'," + omodel.HBillStatus.ToString() + "," + omodel.HCheckItemNowID.ToString() + "," + omodel.HCheckItemNextID.ToString() +
                "," + omodel.HICMOInterID.ToString() + ",'" + omodel.HICMOBillNo + "'," + omodel.HMaterID.ToString() + ",'" + omodel.HMaterNumber + "'," + omodel.HUnitID.ToString() +
                ",'" + omodel.HUnitNumber + "'," + omodel.HPlanQty.ToString() + ",'" + omodel.HPlanBeginDate.ToShortDateString() + "','" + omodel.HPlanEndDate.ToShortDateString() + "','" + omodel.HExplanation +"'"+
                ",'" + omodel.HRemark + "','" + omodel.HInnerBillNo + "','" + DBUtility.ClsPub.CurUserName + "',getdate()" +
                ") ");
                //插入子表
                foreach (Models.ClsSc_ProcessPlanSub oSub in DetailColl)
                {
                    oCn.RunProc("Insert into Sc_ProcessPlanSub " +
                  " (HInterID,HEntryID,HBillNo,HProcNo,HProcID,HWorkingQty" +
                  ",HProcNumber,HWorkRemark,HCenterID,HDeptID,HDeptNumber" +
                  ",HGroupID,HGroupNumber,HWorkerID,HWorkerNumber,HSourceID" +
                  ",HQty,HTimeUnit,HPlanWorkTimes,HPlanBeginDate,HPlanEndDate" +
                  ",HICMOInterID,HICMOBillNo,HSeOrderInterID,HSeOrderEntryID,HSeOrderBillNo" +
                  ",HCloseMan,HCloseType,HRemark,HSourceInterID,HSourceEntryID" +
                  ",HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" +
                  ",HBeginDayQty,HBeginFixQty,HFixWorkDays,HTrunWorkDays,HReadyTimes" +
                  ",HReadyTime,HQueueTime,HMoveTime,HBatchNo" +
                  ") values("
                  + omodel.HInterID.ToString() + "," + oSub.HEntryID.ToString() + ",'" + oSub.HBillNo + "'," + oSub.HProcNo.ToString() + "," + oSub.HProcID.ToString() + "," + oSub.HWorkingQty.ToString() +
                  ",'" + oSub.HProcNumber + "','" + oSub.HWorkRemark + "'," + oSub.HCenterID.ToString() + "," + oSub.HDeptID.ToString() + ",'" + oSub.HDeptNumber + "'" +
                  "," + oSub.HGroupID.ToString() + ",'" + oSub.HGroupNumber + "'," + oSub.HWorkerID.ToString() + ",'" + oSub.HWorkerNumber + "'," + oSub.HSourceID.ToString() +
                  "," + oSub.HQty.ToString() + ",'" + oSub.HTimeUnit + "'," + oSub.HPlanWorkTimes.ToString() + ",'" + oSub.HPlanBeginDate + "','" + oSub.HPlanEndDate + "'" +
                  "," + oSub.HICMOInterID.ToString() + ",'" + oSub.HICMOBillNo + "'," + oSub.HSeOrderInterID.ToString() + "," + oSub.HSeOrderEntryID.ToString() + ",'" + oSub.HSeOrderBillNo + "'" +
                  ",'" + oSub.HCloseMan + "'," + 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.HBeginDayQty.ToString() + "," + oSub.HBeginFixQty.ToString() + "," + oSub.HFixWorkDays.ToString() + "," + oSub.HTrunWorkDays.ToString() + "," + oSub.HReadyTimes.ToString() +
                  "," + oSub.HReadyTime.ToString() + "," + oSub.HQueueTime.ToString() + "," + oSub.HMoveTime.ToString() + ",'" +oSub.HBatchNo + "'" +
                  ") ");
                }
                sReturn = "新增单据成功!";
                oCn.Commit();
                return true;
            }
            catch (Exception e)
            {
                sReturn = e.Message;
                oCn.RollBack();
                throw (e);
            }
        }
        //显示单据
        public override bool ShowBill(Int64 lngBillKey, ref string sReturn)
        {
            try
            {
                //查询主表
                DataSet Ds ;
                Ds = oCn.RunProcReturn("Select * from Sc_ProcessPlanMain Where HInterID=" + lngBillKey.ToString(), "Sc_ProcessPlanMain");
                if(Ds.Tables[0].Rows.Count==0)
                {
                    sReturn = "单据未找到!";
                    return false;
                }
                //赋值
                omodel.HYear = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HYear"]);
                omodel.HPeriod = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HPeriod"]);
                omodel.HBillType = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBillType"]);
                omodel.HBillSubType = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBillSubType"]);
                omodel.HInterID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HInterID"]);
                omodel.HDate = DBUtility.ClsPub.isDate(Ds.Tables[0].Rows[0]["HDate"]);
                omodel.HBillNo = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBillNo"]);
                omodel.HBillStatus = DBUtility.ClsPub.isInt(Ds.Tables[0].Rows[0]["HBillStatus"]);
                omodel.HCheckItemNowID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HCheckItemNowID"]);
                omodel.HCheckItemNextID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HCheckItemNextID"]);
                //
                omodel.HICMOInterID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HICMOInterID"]);
                omodel.HICMOBillNo = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HICMOBillNo"]);
                omodel.HMaterID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HMaterID"]);
                omodel.HMaterNumber = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HMaterNumber"]);
                omodel.HUnitID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HUnitID"]);
                omodel.HUnitNumber = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HUnitNumber"]);
                omodel.HPlanQty = DBUtility.ClsPub.isDoule(Ds.Tables[0].Rows[0]["HPlanQty"]);
                omodel.HPlanBeginDate = DBUtility.ClsPub.isDate(Ds.Tables[0].Rows[0]["HPlanBeginDate"]);
                omodel.HPlanEndDate = DBUtility.ClsPub.isDate(Ds.Tables[0].Rows[0]["HPlanEndDate"]);
                omodel.HExplanation = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HExplanation"]);
                omodel.HRemark = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HRemark"]);
                omodel.HInnerBillNo = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HInnerBillNo"]);
                //
                omodel.HBacker = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBacker"]);
                omodel.HBackDate = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBackDate"]);
                omodel.HChecker = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HChecker"]);
                omodel.HCheckDate = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HCheckDate"]);
                omodel.HMaker = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HMaker"]);
                omodel.HMakeDate = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HMakeDate"]);
                omodel.HUpDater = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HUpDater"]);
                omodel.HUpDateDate = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HUpDateDate"]);
                omodel.HCloseMan = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HCloseMan"]);
                omodel.HCloseDate = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HCloseDate"]);
                omodel.HCloseType = DBUtility.ClsPub.isBool(Ds.Tables[0].Rows[0]["HCloseType"]);
                omodel.HDeleteMan = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HDeleteMan"]);
                omodel.HDeleteDate = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HDeleteDate"]);
                //循环
                DataSet DsSub ;
                DsSub = oCn.RunProcReturn("Select * from Sc_ProcessPlanSub Where HInterID=" + lngBillKey.ToString() + " order by HEntryID ", "Sc_ProcessPlanSub");
                DetailColl.Clear();//清空
                for (int i = 0; i < DsSub.Tables[0].Rows.Count; i++)
                {
                    Models.ClsSc_ProcessPlanSub oSub = new Models.ClsSc_ProcessPlanSub();
                    oSub.HInterID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HInterID"]);
                    oSub.HEntryID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HEntryID"]);
                    //
                    oSub.HBillNo = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HBillNo"]);
                    oSub.HBatchNo = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HBatchNo"]);
                    oSub.HProcNo = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HProcNo"]);
                    oSub.HProcID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HProcID"]);
                    oSub.HProcNumber = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HProcNumber"]);
                    oSub.HWorkRemark = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HWorkRemark"]);
                    oSub.HCenterID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HCenterID"]);
                    oSub.HDeptID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HDeptID"]);
                    oSub.HDeptNumber = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HDeptNumber"]);
                    oSub.HGroupID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HGroupID"]);
                    oSub.HGroupNumber = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HGroupNumber"]);
                    oSub.HWorkerID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HWorkerID"]);
                    oSub.HWorkerNumber = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HWorkerNumber"]);
                    oSub.HSourceID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSourceID"]);
                    oSub.HQty = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HQty"]);
                    oSub.HTimeUnit = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HTimeUnit"]);
                    oSub.HPlanWorkTimes = DBUtility.ClsPub.isSingle(DsSub.Tables[0].Rows[i]["HPlanWorkTimes"]);
                    oSub.HPlanBeginDate = DBUtility.ClsPub.isDate(DsSub.Tables[0].Rows[i]["HPlanBeginDate"]);
                    oSub.HPlanEndDate = DBUtility.ClsPub.isDate(DsSub.Tables[0].Rows[i]["HPlanEndDate"]);
                    oSub.HICMOInterID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HICMOInterID"]);
                    oSub.HICMOBillNo = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HICMOBillNo"]);
                    oSub.HSeOrderInterID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSeOrderInterID"]);
                    oSub.HSeOrderEntryID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSeOrderEntryID"]);
                    oSub.HSeOrderBillNo = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HSeOrderBillNo"]);
                    oSub.HWorkingQty = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HWorkingQty"]);
                    //
                    oSub.HCloseMan = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HCloseMan"]);
                    oSub.HCloseType = DBUtility.ClsPub.isBool(DsSub.Tables[0].Rows[i]["HCloseType"]);
                    oSub.HRemark = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HRemark"]);
                    oSub.HSourceInterID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSourceInterID"]);
                    oSub.HSourceEntryID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSourceEntryID"]);
                    oSub.HSourceBillNo = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HSourceBillNo"]);
                    oSub.HSourceBillType = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HSourceBillType"]);
                    oSub.HRelationQty = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HRelationQty"]);
                    oSub.HRelationMoney = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HRelationMoney"]);
                    oSub.HBeginDayQty = DBUtility.ClsPub.isSingle(DsSub.Tables[0].Rows[i]["HBeginDayQty"]);
                    oSub.HBeginFixQty = DBUtility.ClsPub.isSingle(DsSub.Tables[0].Rows[i]["HBeginFixQty"]);
                    oSub.HFixWorkDays = DBUtility.ClsPub.isSingle(DsSub.Tables[0].Rows[i]["HFixWorkDays"]);
                    oSub.HTrunWorkDays = DBUtility.ClsPub.isSingle(DsSub.Tables[0].Rows[i]["HTrunWorkDays"]);
                    oSub.HReadyTimes = DBUtility.ClsPub.isSingle(DsSub.Tables[0].Rows[i]["HReadyTimes"]);
                    oSub.HReadyTime = DBUtility.ClsPub.isSingle(DsSub.Tables[0].Rows[i]["HReadyTime"]);
                    oSub.HQueueTime = DBUtility.ClsPub.isSingle(DsSub.Tables[0].Rows[i]["HQueueTime"]);
                    oSub.HMoveTime = DBUtility.ClsPub.isSingle(DsSub.Tables[0].Rows[i]["HMoveTime"]);
                    DetailColl.Add(oSub);
                }
                sReturn = "显示单据成功!";
                return true;
            }
            catch (Exception e)
            {
                sReturn = e.Message;
                throw (e);
            }
        }
    }
}
WebAPI/Models/ClsSb_EquipRepairSendWorkBillMain.cs
New file
@@ -0,0 +1,23 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace WebAPI.Models
{
    public class ClsSb_EquipRepairSendWorkBillMain : DBUtility.ClsXt_BaseBillMain
    {
        public Int64 HEquipID;
        public Int64 HRepairID;
        public Int64 HPlanTimes;
        public DateTime HRepairPlanBeginDate;
        public DateTime HRepairPlanEndDate;
        public Int64 HEmpID;
        public Int64 HManagerID;
        public Int64 HDeptID;
        public string HCycleUnit;
        public string HRepairContent;
        public string HExplanation;
        public string HInnerBillNo;
    }
}
WebAPI/Models/ClsSb_EquipRepairSendWorkBillSub.cs
New file
@@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace WebAPI.Models
{
    public class ClsSb_EquipRepairSendWorkBillSub : DBUtility.ClsXt_BaseBillSub
    {
        //============
        public Int64 HRepairID;
        public string HRepairExplanation;
        public Int64 HManagerID;
    }
}
WebAPI/WebAPI.csproj
@@ -479,6 +479,7 @@
    <Compile Include="DLL\ClsSb_EquipMaintainBill.cs" />
    <Compile Include="DLL\ClsSb_EquipMaintainRuleBill.cs" />
    <Compile Include="DLL\ClsSb_EquipRepairCheckBill.cs" />
    <Compile Include="DLL\ClsSb_EquipRepairSendWorkBill.cs" />
    <Compile Include="DLL\ClsSb_EquipRepairWorkBill.cs" />
    <Compile Include="DLL\ClsSb_MouldRepairWorkBill.cs" />
    <Compile Include="DLL\ClsSc_ICMOBillWorkQtyStatus_Tmp.cs" />
@@ -494,6 +495,7 @@
    <Compile Include="DLL\ClsSc_MouldOtherInBill.cs" />
    <Compile Include="DLL\ClsSc_MouldMoveStockStepOutBill.cs" />
    <Compile Include="DLL\ClsSc_PackUnionBill.cs" />
    <Compile Include="DLL\ClsSc_ProcessPlan.cs" />
    <Compile Include="DLL\ClsWW_PPBomBill.cs" />
    <Compile Include="DLL\工资管理\ClsPay_GroupBalBill.cs" />
    <Compile Include="DLL\工资管理\ClsGy_GroupEmpBill.cs" />
@@ -502,6 +504,8 @@
    <Compile Include="InvokeHelper.cs" />
    <Compile Include="Log.cs" />
    <Compile Include="Models\ClsGy_StockCheckItemBill.cs" />
    <Compile Include="Models\ClsSb_EquipRepairSendWorkBillMain.cs" />
    <Compile Include="Models\ClsSb_EquipRepairSendWorkBillSub.cs" />
    <Compile Include="Models\ClsSb_MouldRepairWorkBillMain.cs" />
    <Compile Include="Models\ClsSb_MouldRepairWorkBillSub.cs" />
    <Compile Include="Models\ClsSc_PackUnionBillMain.cs" />