zgq
2021-05-10 b05067e164b141a869285309b1cb4d138e4c78f0
部门设置树形结构-合并
9个文件已添加
5个文件已修改
1677 ■■■■■ 已修改文件
WebAPI/Controllers/Sc_ProcessMangementController.cs 576 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/DLL/ClsWW_EntrustProcessReportBill.cs 298 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/DLL/ClsWW_EntrustProcessSendOutBill.cs 94 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/ListModels.cs 60 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Models/ClsWW_EntrustProcessReportBillMain.cs 42 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Models/ClsWW_EntrustProcessReportBillSub.cs 181 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Models/ClsWW_EntrustProcessSendOutBillMain.cs 46 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Models/ClsWW_EntrustProcessSendOutBillSub.cs 102 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Models/WWReportViewModel.cs 66 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Models/WWSendOutBillViewModel.cs 65 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Models/WW_EntrustProcSendWorkViewModel.cs 75 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Properties/PublishProfiles/API.pubxml.user 17 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Service/LuBaoSevice.cs 46 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/WebAPI.csproj 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Controllers/Sc_ProcessMangementController.cs
@@ -1602,5 +1602,581 @@
        }
        /// <summary>
        /// 保存委外汇报单信息
        /// </summary>
        /// <param name="msg"></param>
        /// <returns></returns>
        [Route("SaveWW_EntrustProcessReportBill")]
        [HttpPost]
        public object SaveWW_EntrustProcessReportBill([FromBody] JObject msg)
        {
            var _value = msg["msg"].ToString();
            string msg1 = _value.ToString();
            string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
            string msg2 = sArray[0].ToString();
            string msg3 = sArray[1].ToString();
            string UserName = "";
            ListModels oListModels = new ListModels();
            try
            {
                WebAPI.DLL.ClsWW_EntrustProcessReportBill Sendwork = new WebAPI.DLL.ClsWW_EntrustProcessReportBill();
                List<WebAPI.Models.ClsWW_EntrustProcessReportBillMain> lsmain = new List<WebAPI.Models.ClsWW_EntrustProcessReportBillMain>();
                msg2 = msg2.Replace("\\", "");
                msg2 = msg2.Replace("\n", "");
                lsmain = oListModels.getObjectByJson_WW_EntrustProcessReportBillMain(msg2);
                foreach (WebAPI.Models.ClsWW_EntrustProcessReportBillMain oItem in lsmain)
                {
                    UserName = oItem.HMaker;
                    oItem.HMakeDate = DBUtility.ClsPub.isStrNull(DateTime.Now.ToString("yyyy-MM-dd"));
                    oItem.HYear = DBUtility.ClsPub.isLong(DateTime.Now.Year);
                    oItem.HDate = DateTime.Now;
                    oItem.HMainSourceInterID = oItem.HInterID;
                    oItem.HInterID = 0;
                    Sendwork.omodel = oItem;
                }
                //表体数据
                //按 },{来拆分数组 //去掉【和】
                msg3 = msg3.Substring(1, msg3.Length - 2);
                msg3 = msg3.Replace("\\", "");
                msg3 = msg3.Replace("\n", "");  //\n
                List<WebAPI.Models.WW_EntrustProcSendWorkViewModel> ls = new List<WebAPI.Models.WW_EntrustProcSendWorkViewModel>();
                ls = oListModels.getObjectByJson_WW_EntrustProcSendWork(msg3);
                int i = 0;
                List<Models.ClsWW_EntrustProcessReportBillSub> lss = new List<Models.ClsWW_EntrustProcessReportBillSub>();
                foreach (WebAPI.Models.WW_EntrustProcSendWorkViewModel oItemSub in ls)
                {
                    i++;
                    Models.ClsWW_EntrustProcessReportBillSub sendworksub = new Models.ClsWW_EntrustProcessReportBillSub();
                    sendworksub.HProcID = 0;//--工序ID
                    sendworksub.HSourceInterID = (long)oItemSub.hmainid;//源单id
                    sendworksub.HSourceEntryID = (long)oItemSub.hsubid; //--源单子ID
                    sendworksub.HSourceBillNo = oItemSub.单据号; //--源单单号
                    sendworksub.HSourceBillType = oItemSub.HBillType; //--源单类型
                    sendworksub.HQty = (decimal)oItemSub.数量; //--数量
                    sendworksub.HICMOBillNo = "";  //--任务单号
                    sendworksub.HSeOrderBillNo = ""; //--销售订单号
                    sendworksub.HSeOrderEntryID = 0; //--销售子ID
                    sendworksub.HSeOrderInterID = 0; //--销售订单主ID
                    sendworksub.HTimes = 0; //--计划工时
                    if (oItemSub.数量 <= 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "保存失败!第" + i.ToString() + "行数量不大于0无法保存!";
                        objJsonResult.data = 1;
                        return objJsonResult;
                    }
                    if (Convert.ToInt32(sendworksub.HQty) > Convert.ToInt32(oItemSub.数量))
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "保存失败!第" + i.ToString() + "行委外汇报数量不能大于委外派工单数量!";
                        objJsonResult.data = 1;
                        return objJsonResult;
                    }
                    sendworksub.HEntryID = i;
                    sendworksub.HEntryCloseDate = DBUtility.ClsPub.isDate(DateTime.Now);
                    sendworksub.HRemark = "";
                    sendworksub.HCloseMan = "";
                    sendworksub.HCloseType = false;
                    lss.Add(sendworksub);//先把数据存放到派工单子表集合里
                }
                if (lss.Count > 0)
                {
                    //然后再循环保存到派工单子表的集合里
                    foreach (Models.ClsWW_EntrustProcessReportBillSub Itemsendwork in lss)
                    {
                        Sendwork.DetailColl.Add(Itemsendwork);
                    }
                }
                else
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "保存失败!lss集合小于0";
                    objJsonResult.data = 1;
                    return objJsonResult;
                }
                //保存
                //保存完毕后处理
                bool bResult;
                if (Sendwork.omodel.HInterID == 0)
                {
                    // bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo);
                    bResult = Sendwork.AddBill(ref DBUtility.ClsPub.sExeReturnInfo);
                }
                else
                {
                    bResult = Sendwork.ModifyBill(Sendwork.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo);
                }
                if (bResult)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "保存成功!";
                    //WebAPIController.Add_Log("送货单下推", UserName, "生成送货单");
                    objJsonResult.data = 1;
                    return objJsonResult;
                }
                else
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "保存失败!" + DBUtility.ClsPub.sExeReturnInfo;
                    objJsonResult.data = 1;
                    return objJsonResult;
                }
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "保存失败!" + e.ToString();
                objJsonResult.data = 1;
                return objJsonResult;
            }
        }
        /// <summary>
        /// 委外派工单号获取信息
        /// </summary>
        /// <returns></returns>
        [Route("Sc_ProcessMangement/WWgetHbarCodeDetail")]
        [HttpGet]
        public ApiResult<DataSet> WWGetHbarCodeDetail(string sBillBarCode)
        {
            var model = LuBaoSevice.WWGetHbarCodeDetail(sBillBarCode);
            return model;
        }
        /// <summary>
        ///委外工序号获得信息
        /// </summary>
        /// <returns></returns>
        [Route("Sc_ProcessMangement/WWgetProcDetail")]
        [HttpGet]
        public ApiResult<DataSet> WWGetProcDetail(string sBillNo, string sProcNo)
        {
            var model = LuBaoSevice.WWGetProcDetail(sBillNo, sProcNo);
            return model;
        }
        /// <summary>
        /// PDA委外工序汇报单保存
        /// </summary>
        /// <param name="msg"></param>
        /// <returns></returns>
        [Route("SaveWWReport")]
        [HttpPost]
        public object SaveWWReport([FromBody] JObject msg)
        {
            var _value = msg["msg"].ToString();
            string msg1 = _value.ToString();
            ListModels oListModels = new ListModels();
            try
            {
                WebAPI.DLL.ClsWW_EntrustProcessReportBill ReportModel = new WebAPI.DLL.ClsWW_EntrustProcessReportBill();
                List<WebAPI.Models.WWReportViewModel> ls = new List<WebAPI.Models.WWReportViewModel>();
                ls = oListModels.getObjectByJson_WWReport(msg1);
                int i = 0;
                foreach (Models.WWReportViewModel ItemView in ls)
                {
                    i++;
                    Models.ClsWW_EntrustProcessReportBillMain ReportMain = new Models.ClsWW_EntrustProcessReportBillMain();
                    Models.ClsWW_EntrustProcessReportBillSub ReportSub = new Models.ClsWW_EntrustProcessReportBillSub();
                    //工序汇报单主表保存
                    ReportMain.HBillType = "3742";
                    ReportMain.HBillNo = ItemView.HBillNo;
                    ReportMain.HMakeDate = DBUtility.ClsPub.isStrNull(DateTime.Now.ToString("yyyy-MM-dd"));
                    ReportMain.HYear = DBUtility.ClsPub.isLong(DateTime.Now.Year);
                    ReportMain.HDate = DateTime.Now;
                    ReportMain.HMaker = "";
                    ReportMain.HCloseType = false;
                    ReportMain.HPrintQty = 0;
                    ReportMain.HMainSourceBillType = "3740";
                    ReportMain.HMainSourceInterID =0;
                    ReportMain.HMainSourceBillNo = ItemView.HWW_BillNo;
                    ReportMain.HInterID = 0;
                    ReportMain.HPeriod = 1;
                    ReportMain.HBillSubType = "3742";
                    ReportMain.HBillStatus = 0;
                    ReportMain.HCheckItemNowID = 0;
                    ReportMain.HCheckItemNextID = 0;
                    ReportMain.HDeptID = Convert.ToInt32(ItemView.HDeptID);
                    ReportMain.HExplanation = "";
                    ReportMain.HInnerBillNo = "";
                    ReportMain.HSupID =Convert.ToInt32( ItemView.HSupID);
                    //保存到汇报单主表
                    ReportModel.omodel = ReportMain;
                    ReportSub.HMaterID = Convert.ToInt32(ItemView.HMaterID);
                    ReportSub.HICMOBillNo = "";
                    ReportSub.HICMOInterID = 0;
                    ReportSub.HEntryID = i;
                    ReportSub.HEntryCloseDate = DBUtility.ClsPub.isDate(DateTime.Now);
                    ReportSub.HRemark = "";
                    ReportSub.HCloseMan = "";
                    ReportSub.HCloseType = false;
                    ReportSub.HSourceBillType = "3740";
                    ReportSub.HQty = Convert.ToDecimal(ItemView.HQty);
                    ReportSub.HProcID =Convert.ToInt32( ItemView.HProcID);
                    ReportSub.HTimes = 0;
                    ReportSub.HSeOrderInterID = 0;
                    ReportSub.HSeOrderEntryID = 0;
                    ReportSub.HSeOrderBillNo = "";
                    ReportSub.HProcPlanInterID = 0;
                    ReportSub.HProcPlanBillNo = "";
                    ReportSub.HSourceInterID = 0;
                    ReportSub.HSourceBillNo = "";
                    ReportSub.HRelationQty = 0;
                    ReportSub.HRelationMoney = 0;
                    ReportSub.HCheckQty = 0;
                    ReportSub.HBadCount = 0;
                    ReportSub.HWasterQty = 0;
                    ReportSub.HWasterQty2 = 0;
                    ReportSub.HPrice = 0;
                    ReportSub.HMoney = 0;
                    ReportSub.HProcPlanInterID = 0;
                    ReportSub.HProcPlanEntryID = 0;
                    ReportSub.HProcPlanBillNo = "";
                    ReportSub.HSourceEntryID = 0;
                    ReportSub.HSourceBillType = "";
                    ReportSub.HRelationQty = 0;
                    ReportSub.HRelationMoney = 0;
                    ReportSub.HBadPrirce = 0;
                    ReportSub.HBadMoney = 0;
                    ReportSub.HWasterPrice = 0;
                    ReportSub.HWasterMoney = 0;
                    ReportSub.HQualityRate = 0;
                    ReportSub.HUsingQty = 0;
                    ReportSub.HSelfBadCount = 0;
                    ReportSub.HPreBadCount = 0;
                    ReportSub.HPayMentQty = 0;
                    ReportSub.HPackType = "";
                    ReportSub.HCheckEmpID = 0;
                    ReportSub.HWeight = 0;
                    ReportSub.HBatchNo = "";
                    //保存到委外汇报单子表
                    ReportModel.DetailColl.Add(ReportSub);
                }
                //保存
                //保存完毕后处理
                bool bResult;
                bResult = ReportModel.AddBill(ref DBUtility.ClsPub.sExeReturnInfo);
                if (bResult)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "保存成功!";
                    //WebAPIController.Add_Log("送货单下推", UserName, "生成送货单");
                    objJsonResult.data = 1;
                    return objJsonResult;
                }
                else
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "保存失败!" + DBUtility.ClsPub.sExeReturnInfo;
                    objJsonResult.data = 1;
                    return objJsonResult;
                }
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "保存失败!" + e.ToString();
                objJsonResult.data = 1;
                return objJsonResult;
            }
        }
        /// <summary>
        /// 保存委外转出单信息
        /// </summary>
        /// <param name="msg"></param>
        /// <returns></returns>
        [Route("SaveWW_EntrustProcessSendOutBill")]
        [HttpPost]
        public object SaveWW_EntrustProcessSendOutBill([FromBody] JObject msg)
        {
            var _value = msg["msg"].ToString();
            string msg1 = _value.ToString();
            string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
            string msg2 = sArray[0].ToString();
            string msg3 = sArray[1].ToString();
            string UserName = "";
            ListModels oListModels = new ListModels();
            try
            {
                WebAPI.DLL.ClsWW_EntrustProcessSendOutBill Sendwork = new WebAPI.DLL.ClsWW_EntrustProcessSendOutBill();
                List<WebAPI.Models.ClsWW_EntrustProcessSendOutBillMain> lsmain = new List<WebAPI.Models.ClsWW_EntrustProcessSendOutBillMain>();
                msg2 = msg2.Replace("\\", "");
                msg2 = msg2.Replace("\n", "");
                lsmain = oListModels.getObjectByJson_WW_EntrustProcessSendOutBillMain(msg2);
                foreach (WebAPI.Models.ClsWW_EntrustProcessSendOutBillMain oItem in lsmain)
                {
                    UserName = oItem.HMaker;
                    oItem.HMakeDate = DBUtility.ClsPub.isStrNull(DateTime.Now.ToString("yyyy-MM-dd"));
                    oItem.HYear = DBUtility.ClsPub.isLong(DateTime.Now.Year);
                    oItem.HDate = DateTime.Now;
                    oItem.HMainSourceInterID = oItem.HInterID;
                    oItem.HInterID = 0;
                    Sendwork.omodel = oItem;
                }
                //表体数据
                //按 },{来拆分数组 //去掉【和】
                msg3 = msg3.Substring(1, msg3.Length - 2);
                msg3 = msg3.Replace("\\", "");
                msg3 = msg3.Replace("\n", "");  //\n
                List<WebAPI.Models.WW_EntrustProcSendWorkViewModel> ls = new List<WebAPI.Models.WW_EntrustProcSendWorkViewModel>();
                ls = oListModels.getObjectByJson_WW_EntrustProcSendWork(msg3);
                int i = 0;
                List<Models.ClsWW_EntrustProcessSendOutBillSub> lss = new List<Models.ClsWW_EntrustProcessSendOutBillSub>();
                foreach (WebAPI.Models.WW_EntrustProcSendWorkViewModel oItemSub in ls)
                {
                    i++;
                    Models.ClsWW_EntrustProcessSendOutBillSub sendworksub = new Models.ClsWW_EntrustProcessSendOutBillSub();
                    sendworksub.HProcID = 0;//--工序ID
                    sendworksub.HSourceInterID = (long)oItemSub.hmainid;//源单id
                    sendworksub.HSourceEntryID = (long)oItemSub.hsubid; //--源单子ID
                    sendworksub.HSourceBillNo = oItemSub.单据号; //--源单单号
                    sendworksub.HSourceBillType = oItemSub.HBillType; //--源单类型
                    sendworksub.HQty = (decimal)oItemSub.数量; //--数量
                    sendworksub.HICMOBillNo = "";  //--任务单号
                    sendworksub.HSeOrderBillNo = ""; //--销售订单号
                    sendworksub.HSeOrderEntryID = 0; //--销售子ID
                    sendworksub.HSeOrderInterID = 0; //--销售订单主ID
                    if (oItemSub.数量 <= 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "保存失败!第" + i.ToString() + "行数量不大于0无法保存!";
                        objJsonResult.data = 1;
                        return objJsonResult;
                    }
                    if (Convert.ToInt32(sendworksub.HQty) > Convert.ToInt32(oItemSub.数量))
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "保存失败!第" + i.ToString() + "行委外汇报数量不能大于委外派工单数量!";
                        objJsonResult.data = 1;
                        return objJsonResult;
                    }
                    sendworksub.HEntryID = i;
                    sendworksub.HEntryCloseDate = DBUtility.ClsPub.isDate(DateTime.Now);
                    sendworksub.HRemark = "";
                    sendworksub.HCloseMan = "";
                    sendworksub.HCloseType = false;
                    lss.Add(sendworksub);//先把数据存放到派工单子表集合里
                }
                if (lss.Count > 0)
                {
                    //然后再循环保存到派工单子表的集合里
                    foreach (Models.ClsWW_EntrustProcessSendOutBillSub Itemsendwork in lss)
                    {
                        Sendwork.DetailColl.Add(Itemsendwork);
                    }
                }
                else
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "保存失败!lss集合小于0";
                    objJsonResult.data = 1;
                    return objJsonResult;
                }
                //保存
                //保存完毕后处理
                bool bResult;
                if (Sendwork.omodel.HInterID == 0)
                {
                    // bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo);
                    bResult = Sendwork.AddBill(ref DBUtility.ClsPub.sExeReturnInfo);
                }
                else
                {
                    bResult = Sendwork.ModifyBill(Sendwork.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo);
                }
                if (bResult)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "保存成功!";
                    //WebAPIController.Add_Log("送货单下推", UserName, "生成送货单");
                    objJsonResult.data = 1;
                    return objJsonResult;
                }
                else
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "保存失败!" + DBUtility.ClsPub.sExeReturnInfo;
                    objJsonResult.data = 1;
                    return objJsonResult;
                }
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "保存失败!" + e.ToString();
                objJsonResult.data = 1;
                return objJsonResult;
            }
        }
        /// <summary>
        /// PDA委外工序转出单保存
        /// </summary>
        /// <param name="msg"></param>
        /// <returns></returns>
        [Route("SaveWWSendOutBill")]
        [HttpPost]
        public object SaveWWSendOutBill([FromBody] JObject msg)
        {
            var _value = msg["msg"].ToString();
            string msg1 = _value.ToString();
            ListModels oListModels = new ListModels();
            try
            {
                WebAPI.DLL.ClsWW_EntrustProcessSendOutBill ReportModel = new WebAPI.DLL.ClsWW_EntrustProcessSendOutBill();
                List<WebAPI.Models.WWSendOutBillViewModel> ls = new List<WebAPI.Models.WWSendOutBillViewModel>();
                ls = oListModels.getObjectByJson_WWSendOutBill(msg1);
                int i = 0;
                foreach (Models.WWSendOutBillViewModel ItemView in ls)
                {
                    i++;
                    Models.ClsWW_EntrustProcessSendOutBillMain ReportMain = new Models.ClsWW_EntrustProcessSendOutBillMain();
                    Models.ClsWW_EntrustProcessSendOutBillSub ReportSub = new Models.ClsWW_EntrustProcessSendOutBillSub();
                    //工序转出单主表保存
                    ReportMain.HBillType = "3741";
                    ReportMain.HBillNo = ItemView.HBillNo;
                    ReportMain.HMakeDate = DBUtility.ClsPub.isStrNull(DateTime.Now.ToString("yyyy-MM-dd"));
                    ReportMain.HYear = DBUtility.ClsPub.isLong(DateTime.Now.Year);
                    ReportMain.HDate = DateTime.Now;
                    ReportMain.HMaker = "";
                    ReportMain.HCloseType = false;
                    ReportMain.HPrintQty = 0;
                    ReportMain.HMainSourceBillType = "3740";
                    ReportMain.HMainSourceInterID = 0;
                    ReportMain.HMainSourceBillNo = ItemView.HWW_BillNo;
                    ReportMain.HInterID = 0;
                    ReportMain.HPeriod = 1;
                    ReportMain.HBillSubType = "3741";
                    ReportMain.HBillStatus = 0;
                    ReportMain.HCheckItemNowID = 0;
                    ReportMain.HCheckItemNextID = 0;
                    ReportMain.HDeptID = Convert.ToInt32(ItemView.HDeptID);
                    ReportMain.HExplanation = "";
                    ReportMain.HInnerBillNo = "";
                    ReportMain.HSupID = Convert.ToInt32(ItemView.HSupID);
                    //保存到转出单主表
                    ReportModel.omodel = ReportMain;
                    ReportSub.HMaterID = Convert.ToInt32(ItemView.HMaterID);
                    ReportSub.HICMOBillNo = "";
                    ReportSub.HICMOInterID = 0;
                    ReportSub.HEntryID = i;
                    ReportSub.HEntryCloseDate = DBUtility.ClsPub.isDate(DateTime.Now);
                    ReportSub.HRemark = "";
                    ReportSub.HCloseMan = "";
                    ReportSub.HCloseType = false;
                    ReportSub.HSourceBillType = "3740";
                    ReportSub.HQty = Convert.ToDecimal(ItemView.HQty);
                    ReportSub.HProcID = Convert.ToInt32(ItemView.HProcID);
                    ReportSub.HSeOrderInterID = 0;
                    ReportSub.HSeOrderEntryID = 0;
                    ReportSub.HSeOrderBillNo = "";
                    ReportSub.HProcPlanInterID = 0;
                    ReportSub.HProcPlanBillNo = "";
                    ReportSub.HSourceInterID = 0;
                    ReportSub.HSourceBillNo = "";
                    ReportSub.HRelationQty = 0;
                    ReportSub.HRelationMoney = 0;
                    ReportSub.HPrice = 0;
                    ReportSub.HMoney = 0;
                    ReportSub.HProcPlanInterID = 0;
                    ReportSub.HProcPlanEntryID = 0;
                    ReportSub.HProcPlanBillNo = "";
                    ReportSub.HSourceEntryID = 0;
                    ReportSub.HSourceBillType = "";
                    ReportSub.HRelationQty = 0;
                    ReportSub.HRelationMoney = 0;
                    ReportSub.HPackType = "";
                    ReportSub.HBatchNo = "";
                    //保存到委外转出单子表
                    ReportModel.DetailColl.Add(ReportSub);
                }
                //保存
                //保存完毕后处理
                bool bResult;
                bResult = ReportModel.AddBill(ref DBUtility.ClsPub.sExeReturnInfo);
                if (bResult)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "保存成功!";
                    //WebAPIController.Add_Log("送货单下推", UserName, "生成送货单");
                    objJsonResult.data = 1;
                    return objJsonResult;
                }
                else
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "保存失败!" + DBUtility.ClsPub.sExeReturnInfo;
                    objJsonResult.data = 1;
                    return objJsonResult;
                }
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "保存失败!" + e.ToString();
                objJsonResult.data = 1;
                return objJsonResult;
            }
        }
    }
}
WebAPI/DLL/ClsWW_EntrustProcessReportBill.cs
New file
@@ -0,0 +1,298 @@
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Web;
namespace WebAPI.DLL
{
    public class ClsWW_EntrustProcessReportBill : DBUtility.ClsXt_BaseBill
    {
        public WebAPI.Models.ClsWW_EntrustProcessReportBillMain omodel = new WebAPI.Models.ClsWW_EntrustProcessReportBillMain();
        public List<WebAPI.Models.ClsWW_EntrustProcessReportBillSub> DetailColl = new List<WebAPI.Models.ClsWW_EntrustProcessReportBillSub>();
        public ClsWW_EntrustProcessReportBill()
        {
            base.MvarItemKeySub = "WW_EntrustProcessReportBillSub";
            base.MvarItemKeySub2 = "";
            base.MvarItemKeySub3 = "";
            base.MvarItemKeySub4 = "";
            base.MvarItemKey = "WW_EntrustProcessReportBillMain";
            base.MvarReportTitle = "委外工序计划汇报单";
            base.BillType = "3742";
            base.HBillSubType = "3742";
        }
        #region 固定代码
        ~ClsWW_EntrustProcessReportBill()
        {
            DetailColl = null;
        }
        #endregion   自定义方法
        #region
        ////修改单据
        //public override bool ModifyBill(Int64 lngBillKey, ref string sReturn)
        //{
        //    try
        //    {
        //        //
        //        oCn.BeginTran();
        //        //更新主表
        //        oCn.RunProc("UpDate Sc_ProcessSendWorkMain 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() +
        //        ",HCheckFlowID=" + omodel.HCheckFlowID.ToString() +
        //        ",HICMOInterID=" + omodel.HICMOInterID.ToString() +
        //        ",HICMOBillNo='" + omodel.HICMOBillNo + "'" +
        //        ",HProcPlanBillNo='" + omodel.HProcPlanBillNo + "'" +
        //        ",HPlanBeginDate='" + omodel.HPlanBeginDate.ToShortDateString() + "'" +
        //        ",HPlanEndDate='" + omodel.HPlanEndDate.ToShortDateString() + "'" +
        //        ",HBatchNo='" + omodel.HBatchNo + "'" +
        //        ",HSeOrderInterID=" + omodel.HSeOrderInterID.ToString() +
        //        ",HSeOrderEntryID=" + omodel.HSeOrderEntryID.ToString() +
        //        ",HSeOrderBillNo='" + omodel.HSeOrderBillNo + "'" +
        //        ",HProcID=" + omodel.HProcID.ToString() +
        //        ",HProcNumber='" + omodel.HProcNumber + "'" +
        //        ",HDeptID=" + omodel.HDeptID.ToString() +
        //        ",HDeptNumber='" + omodel.HDeptNumber + "'" +
        //        ",HGroupID=" + omodel.HGroupID.ToString() +
        //        ",HGroupNumber='" + omodel.HGroupNumber + "'" +
        //        ",HMaterID=" + omodel.HMaterID.ToString() +
        //        ",HMaterNumber='" + omodel.HMaterNumber + "'" +
        //        ",HUnitID=" + omodel.HUnitID.ToString() +
        //        ",HUnitNumber='" + omodel.HUnitNumber + "'" +
        //        ",HRoutingInterID=" + omodel.HRoutingInterID.ToString() +
        //        ",HPlanQty=" + omodel.HPlanQty.ToString() +
        //        ",HExplanation='" + omodel.HExplanation + "'" +
        //        ",HRemark='" + omodel.HRemark + "'" +
        //        ",HInnerBillNo='" + omodel.HInnerBillNo + "'" +
        //        ",HUpDater='" + DBUtility.ClsPub.CurUserName + "'" +
        //        ",HUpDateDate=getdate()" +
        //        ",HSupID=" + omodel.HSupID.ToString() +
        //        " where HInterID=" + lngBillKey.ToString());
        //        //删除关联
        //        DeleteRelation(ref sReturn, lngBillKey);
        //        //删除子表
        //        DeleteBillSub(lngBillKey);
        //        //插入子表
        //        omodel.HInterID = lngBillKey;
        //        foreach (Model.ClsSc_ProcessSendWorkSub oSub in DetailColl)
        //        {
        //            oCn.RunProc("Insert into Sc_ProcessSendWorkSub " +
        //          " (HInterID,HEntryID,HProcID,HProcNumber,HGroupID,HSourceID,HSourceNumber" +
        //          ",HGroupNumber,HWorkerID,HWorkerNumber,HQty,HPlanBeginDate" +
        //          ",HPlanEndDate,HPlanTimes,HSeOrderInterID,HSeOrderEntryID,HSeOrderBillNo" +
        //          ",HICMOBillNo,HICMOInterID,HProcPlanInterID,HProcPlanEntryID,HProcPlanBillNo" +
        //          ",HCloseMan,HCloseType,HRemark,HSourceInterID,HSourceEntryID" +
        //          ",HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" +
        //          ") values("
        //          + omodel.HInterID.ToString() + "," + oSub.HEntryID.ToString() + "," + oSub.HProcID.ToString() + ",'" + oSub.HProcNumber + "'," + oSub.HGroupID.ToString() + "," + oSub.HSourceID.ToString() + ",'" + oSub.HSourceNumber + "'" +
        //          ",'" + oSub.HGroupNumber + "'," + oSub.HWorkerID.ToString() + ",'" + oSub.HWorkerNumber + "'," + oSub.HQty.ToString() + ",'" + oSub.HPlanBeginDate + "'" +
        //          ",'" + oSub.HPlanEndDate + "'," + oSub.HPlanTimes.ToString() + "," + oSub.HSeOrderInterID.ToString() + "," + oSub.HSeOrderEntryID.ToString() + ",'" + oSub.HSeOrderBillNo + "'" +
        //          ",'" + oSub.HICMOBillNo + "'," + oSub.HICMOInterID.ToString() + "," + oSub.HProcPlanInterID.ToString() + "," + oSub.HProcPlanEntryID.ToString() + ",'" + oSub.HProcPlanBillNo + "'" +
        //          ",'" + 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() +
        //          ") ");
        //        }
        //        sReturn = "修改单据成功!";
        //        oCn.Commit();
        //        return true;
        //    }
        //    catch (Exception e)
        //    {
        //        sReturn = e.Message;
        //        oCn.RollBack();
        //        throw (e);
        //    }
        //}
        #endregion
        //新增单据
        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 WW_EntrustProcessReportBillMain   " +
                "(HYear, HPeriod, HBillType, HBillSubType, HInterID" +
                ",HDate, HBillNo, HBillStatus, HCheckItemNowID, HCheckItemNextID" +
                ",HCheckFlowID, HRemark, HBacker, HBackDate, HBackRemark" +
                ",HChecker, HCheckDate, HMaker, HMakeDate, HUpDater" +
                ",HUpDateDate, HCloseMan, HCloseDate, HCloseType,HDeleteMan" +
                ",HDeleteDate,HMainSourceBillType, HMainSourceInterID, HMainSourceEntryID, HMainSourceBillNo" +
                ",[HPrintQty], [HDeptID], [HSupID], [HEmpID], [HExplanation], [HInnerBillNo]" +
                ") " +
                " values(" + omodel.HYear.ToString() + "," + omodel.HPeriod.ToString() + ",'" + this.BillType + "','" + omodel.HBillSubType + "'," + omodel.HInterID.ToString() +
                ",'" + omodel.HDate.ToShortDateString() + "','" + omodel.HBillNo + "'," + omodel.HBillStatus + "," + omodel.HCheckItemNowID.ToString() + "," + omodel.HCheckItemNextID.ToString() +
                "," + omodel.HCheckFlowID.ToString() + ",'" + omodel.HRemark + "','" + omodel.HBacker + "','" + omodel.HBackDate + "','" + omodel.HBackRemark + "'" +
                ",'" + omodel.HChecker + "','" + omodel.HCheckDate + "','" + DBUtility.ClsPub.CurUserName + "',getdate(),'" + omodel.HUpDater + "'" +
                ",'" + omodel.HUpDateDate + "','" + omodel.HCloseMan + "','" + omodel.HCloseDate + "'," + Convert.ToString(omodel.HCloseType ? 1 : 0) + ",'" + omodel.HDeleteMan + "'" +
                ",'" + omodel.HDeleteDate + "','" + omodel.HMainSourceBillType + "'," + omodel.HMainSourceInterID.ToString() + "," + omodel.HMainSourceEntryID.ToString() + ",'" + omodel.HMainSourceBillNo + "'" +
                ",'" + omodel.HPrintQty + "','" + omodel.HDeptID + "','" + omodel.HSupID + "','" + omodel.HEmpID +"'"+
                ",'" + omodel.HExplanation + "','" + omodel.HInnerBillNo + "'" +
                ") ");
                //插入子表
                foreach (Models.ClsWW_EntrustProcessReportBillSub oSub in DetailColl)
                {
                    oCn.RunProc("Insert into WW_EntrustProcessReportBillSub " +
"([HInterID], [HBillNo_bak], [HEntryID], [HCloseMan], [HEntryCloseDate], [HCloseType], [HRemark], [HSourceInterID]" +
",[HSourceEntryID], [HSourceBillNo], [HSourceBillType], [HRelationQty], [HRelationMoney], [HProcID]" +
", [HSupFlag], [HMaterID], [HTimes], [HQty],[HCheckQty], [HBadCount], [HWasterQty], [HWasterQty2], [HWeight]" +
", [HPrice], [HMoney], [HBatchNo], [HBadPrirce], [HBadMoney], [HWasterPrice], [HWasterMoney],[HQualityRate]" +
", [HUsingQty], [HSelfBadCount], [HPreBadCount], [HPayMentQty], [HPackType],[HCheckEmpID], [HProcPlanInterID]" +
", [HProcPlanEntryID], [HProcPlanBillNo], [HICMOInterID],[HICMOEntryID], [HICMOBillNo], [HSeOrderInterID]" +
", [HSeOrderEntryID], [HSeOrderBillNo]" +
") " +
"values(" + omodel.HInterID.ToString() + ",'" + oSub.HBillNo_bak + "'," + 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.HProcID.ToString() + "," + Convert.ToString(oSub.HSupFlag ? 1 : 0) + "," + oSub.HMaterID.ToString() + "," + oSub.HTimes.ToString() +
                  "," + oSub.HQty.ToString() + "," + oSub.HCheckQty.ToString() + "," + oSub.HBadCount.ToString() + "," + oSub.HWasterQty.ToString() + "," + oSub.HWasterQty2.ToString() +
                  "," + oSub.HWeight.ToString() + "," + oSub.HPrice.ToString() + "," + oSub.HMoney.ToString() + ",'" + oSub.HBatchNo + "'," + oSub.HBadPrirce.ToString() +
                  "," + oSub.HBadMoney.ToString() + "," + oSub.HWasterPrice.ToString() + "," + oSub.HWasterMoney.ToString() + "," + oSub.HQualityRate.ToString() + "," + oSub.HUsingQty + "," + oSub.HSelfBadCount + "," + oSub.HPreBadCount.ToString() +
                  "," + oSub.HPayMentQty.ToString() + ",'" + oSub.HPackType + "'," + oSub.HCheckEmpID.ToString() + "," + oSub.HProcPlanInterID.ToString() + "," + oSub.HProcPlanEntryID.ToString() + ",'" + oSub.HProcPlanBillNo + "'," + oSub.HICMOInterID.ToString() + "," + oSub.HICMOEntryID.ToString() +
                   ",'" + oSub.HICMOBillNo + "','" + oSub.HSeOrderInterID + "','" + oSub.HSeOrderEntryID + "','" + oSub.HSeOrderBillNo + "'" +
                   ") ");
                }
                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 WW_EntrustProcessReportBillMain Where HInterID=" + lngBillKey.ToString(), "WW_EntrustProcessReportBillMain");
                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.HSupID = (int)DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HSupID"]);
                omodel.HDeptID = (int)DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HDeptID"]);
                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_ProcessReportSub Where HInterID=" + lngBillKey.ToString() + " order by HEntryID ", "Sc_ProcessReportSub");
                DetailColl.Clear();//清空
                for (int i = 0; i < DsSub.Tables[0].Rows.Count; i++)
                {
                    Models.ClsWW_EntrustProcessReportBillSub oSub = new Models.ClsWW_EntrustProcessReportBillSub();
                    oSub.HInterID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HInterID"]);
                    oSub.HEntryID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HEntryID"]);
                    //
                    oSub.HMaterID = (int)DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HMaterID"]);
                    oSub.HProcID = (int)DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HProcID"]);
                    oSub.HTimes = DBUtility.ClsPub.isSingle(DsSub.Tables[0].Rows[i]["HTimes"]);
                    oSub.HQty = (decimal)DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HQty"]);
                    oSub.HCheckQty = (decimal)DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HCheckQty"]);
                    oSub.HBadCount = DBUtility.ClsPub.isSingle(DsSub.Tables[0].Rows[i]["HBadCount"]);
                    oSub.HWasterQty = DBUtility.ClsPub.isSingle(DsSub.Tables[0].Rows[i]["HWasterQty"]);
                    oSub.HWasterQty2 = DBUtility.ClsPub.isSingle(DsSub.Tables[0].Rows[i]["HWasterQty2"]);
                    oSub.HPrice = (decimal)DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HPrice"]);
                    oSub.HMoney = DBUtility.ClsPub.isSingle(DsSub.Tables[0].Rows[i]["HMoney"]);
                    //addnew
                    oSub.HBadPrirce = DBUtility.ClsPub.isSingle(DsSub.Tables[0].Rows[i]["HBadPrirce"]);
                    oSub.HBadMoney = DBUtility.ClsPub.isSingle(DsSub.Tables[0].Rows[i]["HBadMoney"]);
                    oSub.HWasterPrice = DBUtility.ClsPub.isSingle(DsSub.Tables[0].Rows[i]["HWasterPrice"]);
                    oSub.HWasterMoney = DBUtility.ClsPub.isSingle(DsSub.Tables[0].Rows[i]["HWasterMoney"]);
                    oSub.HQualityRate = DBUtility.ClsPub.isSingle(DsSub.Tables[0].Rows[i]["HQualityRate"]);
                    oSub.HUsingQty = DBUtility.ClsPub.isSingle(DsSub.Tables[0].Rows[i]["HUsingQty"]);
                    oSub.HSelfBadCount = DBUtility.ClsPub.isSingle(DsSub.Tables[0].Rows[i]["HSelfBadCount"]);
                    oSub.HPreBadCount = DBUtility.ClsPub.isSingle(DsSub.Tables[0].Rows[i]["HPreBadCount"]);
                    oSub.HPayMentQty = DBUtility.ClsPub.isSingle(DsSub.Tables[0].Rows[i]["HPayMentQty"]);
                    oSub.HBatchNo = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HBatchNo"]);
                    oSub.HPackType = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HPackType"]);
                    oSub.HCheckEmpID = (int)DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HCheckEmpID"]);
                    //
                    oSub.HProcPlanInterID = (int)DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HProcPlanInterID"]);
                    oSub.HProcPlanEntryID = (int)DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HProcPlanEntryID"]);
                    oSub.HProcPlanBillNo = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HProcPlanBillNo"]);
                    oSub.HICMOInterID = (int)DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HICMOInterID"]);
                    oSub.HICMOBillNo = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HICMOBillNo"]);
                    oSub.HSeOrderInterID = (int)DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSeOrderInterID"]);
                    oSub.HSeOrderEntryID = (int)DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSeOrderEntryID"]);
                    oSub.HSeOrderBillNo = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HSeOrderBillNo"]);
                    //
                    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"]);
                    DetailColl.Add(oSub);
                }
                sReturn = "显示单据成功!";
                return true;
            }
            catch (Exception e)
            {
                sReturn = e.Message;
                throw (e);
            }
        }
    }
}
WebAPI/DLL/ClsWW_EntrustProcessSendOutBill.cs
New file
@@ -0,0 +1,94 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace WebAPI.DLL
{
    public class ClsWW_EntrustProcessSendOutBill : DBUtility.ClsXt_BaseBill
    {
        public WebAPI.Models.ClsWW_EntrustProcessSendOutBillMain omodel = new WebAPI.Models.ClsWW_EntrustProcessSendOutBillMain();
        public List<WebAPI.Models.ClsWW_EntrustProcessSendOutBillSub> DetailColl = new List<WebAPI.Models.ClsWW_EntrustProcessSendOutBillSub>();
        public ClsWW_EntrustProcessSendOutBill()
        {
            base.MvarItemKeySub = "WW_EntrustProcessSendOutBillSub";
            base.MvarItemKeySub2 = "";
            base.MvarItemKeySub3 = "";
            base.MvarItemKeySub4 = "";
            base.MvarItemKey = "WW_EntrustProcessSendOutBillMain";
            base.MvarReportTitle = "委外工序计划转出单";
            base.BillType = "3741";
            base.HBillSubType = "3741";
        }
        #region 固定代码
        ~ClsWW_EntrustProcessSendOutBill()
        {
            DetailColl = null;
        }
        #endregion   自定义方法
        //新增单据
        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 WW_EntrustProcessSendOutBillMain   " +
                "(HYear, HPeriod, HBillType, HBillSubType, HInterID" +
                ",HDate, HBillNo, HBillStatus, HCheckItemNowID, HCheckItemNextID" +
                ",HCheckFlowID, HRemark, HBacker, HBackDate, HBackRemark" +
                ",HChecker, HCheckDate, HMaker, HMakeDate, HUpDater" +
                ",HUpDateDate, HCloseMan, HCloseDate, HCloseType,HDeleteMan" +
                ",HDeleteDate,HMainSourceBillType, HMainSourceInterID, HMainSourceEntryID, HMainSourceBillNo" +
                ",[HPrintQty], [HDeptID], [HSupID], [HEmpID], [HExplanation], [HInnerBillNo]" +
                ") " +
                " values(" + omodel.HYear.ToString() + "," + omodel.HPeriod.ToString() + ",'" + this.BillType + "','" + omodel.HBillSubType + "'," + omodel.HInterID.ToString() +
                ",'" + omodel.HDate.ToShortDateString() + "','" + omodel.HBillNo + "'," + omodel.HBillStatus + "," + omodel.HCheckItemNowID.ToString() + "," + omodel.HCheckItemNextID.ToString() +
                "," + omodel.HCheckFlowID.ToString() + ",'" + omodel.HRemark + "','" + omodel.HBacker + "','" + omodel.HBackDate + "','" + omodel.HBackRemark + "'" +
                ",'" + omodel.HChecker + "','" + omodel.HCheckDate + "','" + DBUtility.ClsPub.CurUserName + "',getdate(),'" + omodel.HUpDater + "'" +
                ",'" + omodel.HUpDateDate + "','" + omodel.HCloseMan + "','" + omodel.HCloseDate + "'," + Convert.ToString(omodel.HCloseType ? 1 : 0) + ",'" + omodel.HDeleteMan + "'" +
                ",'" + omodel.HDeleteDate + "','" + omodel.HMainSourceBillType + "'," + omodel.HMainSourceInterID.ToString() + "," + omodel.HMainSourceEntryID.ToString() + ",'" + omodel.HMainSourceBillNo + "'" +
                "," + omodel.HPrintQty.ToString() + ",'" + omodel.HDeptID + "'," + omodel.HSupID.ToString() + "," + omodel.HEmpID.ToString()  +
                ",'" + omodel.HExplanation + "','" + omodel.HInnerBillNo + "'" +
                ") ");
                //插入子表
                foreach (Models.ClsWW_EntrustProcessSendOutBillSub oSub in DetailColl)
                {
                    oCn.RunProc("Insert into WW_EntrustProcessSendOutBillSub " +
"([HInterID], [HBillNo_bak], [HEntryID], [HCloseMan], [HEntryCloseDate], [HCloseType], [HRemark], [HSourceInterID]" +
",[HSourceEntryID], [HSourceBillNo], [HSourceBillType], [HRelationQty], [HRelationMoney], [HProcID]" +
", [HSupFlag], [HMaterID], [HQty],[HPrice], [HMoney], [HBatchNo], [HPackType], [HProcPlanInterID]" +
", [HProcPlanEntryID], [HProcPlanBillNo], [HICMOInterID], [HICMOEntryID], [HICMOBillNo], [HSeOrderInterID], [HSeOrderEntryID],[HSeOrderBillNo]" +
") " +
"values(" + omodel.HInterID.ToString() + ",'" + oSub.HBillNo_bak + "'," + 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.HProcID.ToString() + "," + Convert.ToString(oSub.HSupFlag ? 1 : 0) + "," + oSub.HMaterID.ToString() + "," + oSub.HQty.ToString() +
                  ","  + oSub.HPrice.ToString() + "," + oSub.HMoney.ToString() + ",'" + oSub.HBatchNo + "','" + oSub.HPackType+"'" +
                  "," + oSub.HProcPlanInterID.ToString() + "," + oSub.HProcPlanEntryID.ToString() + ",'" + oSub.HProcPlanBillNo+ "'," + oSub.HICMOInterID.ToString() + "," + oSub.HICMOEntryID.ToString() +
                  ",'" + oSub.HICMOBillNo + "'," + oSub.HSeOrderInterID.ToString() + "," + oSub.HSeOrderEntryID.ToString() + ",'" + oSub.HSeOrderBillNo +"'"+
                   ") ");
                }
                sReturn = "新增单据成功!";
                oCn.Commit();
                return true;
            }
            catch (Exception e)
            {
                sReturn = e.Message;
                oCn.RollBack();
                throw (e);
            }
        }
    }
}
WebAPI/ListModels.cs
@@ -261,7 +261,65 @@
            return list;
        }
        /// <summary>
        /// 委外汇报单主表json处理
        /// </summary>
        /// <param name="jsonString"></param>
        /// <returns></returns>
        public List<WebAPI.Models.ClsWW_EntrustProcessReportBillMain> getObjectByJson_WW_EntrustProcessReportBillMain(string jsonString)
        {
            jsonString = "[" + jsonString.ToString() + "]";
            List<WebAPI.Models.ClsWW_EntrustProcessReportBillMain> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<WebAPI.Models.ClsWW_EntrustProcessReportBillMain>>(jsonString);
            return list;
        }
        /// <summary>
        /// 委外派工单视图模型json处理
        /// </summary>
        /// <param name="jsonString"></param>
        /// <returns></returns>
        public List<WebAPI.Models.WW_EntrustProcSendWorkViewModel> getObjectByJson_WW_EntrustProcSendWork(string jsonString)
        {
            jsonString = "[" + jsonString.ToString() + "]";
            List<WebAPI.Models.WW_EntrustProcSendWorkViewModel> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<WebAPI.Models.WW_EntrustProcSendWorkViewModel>>(jsonString);
            return list;
        }
        /// <summary>
        /// 视图模型json处理
        /// </summary>
        /// <param name="jsonString"></param>
        /// <returns></returns>
        public List<WebAPI.Models.WWReportViewModel> getObjectByJson_WWReport(string jsonString)
        {
            jsonString = "[" + jsonString.ToString() + "]";
            List<WebAPI.Models.WWReportViewModel> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<WebAPI.Models.WWReportViewModel>>(jsonString);
            return list;
        }
        /// <summary>
        /// 委外转出单主表json处理
        /// </summary>
        /// <param name="jsonString"></param>
        /// <returns></returns>
        public List<WebAPI.Models.ClsWW_EntrustProcessSendOutBillMain> getObjectByJson_WW_EntrustProcessSendOutBillMain(string jsonString)
        {
            jsonString = "[" + jsonString.ToString() + "]";
            List<WebAPI.Models.ClsWW_EntrustProcessSendOutBillMain> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<WebAPI.Models.ClsWW_EntrustProcessSendOutBillMain>>(jsonString);
            return list;
        }
        /// <summary>
        /// 视图模型json处理
        /// </summary>
        /// <param name="jsonString"></param>
        /// <returns></returns>
        public List<WebAPI.Models.WWSendOutBillViewModel> getObjectByJson_WWSendOutBill(string jsonString)
        {
            jsonString = "[" + jsonString.ToString() + "]";
            List<WebAPI.Models.WWSendOutBillViewModel> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<WebAPI.Models.WWSendOutBillViewModel>>(jsonString);
            return list;
        }
    }
}
WebAPI/Models/ClsWW_EntrustProcessReportBillMain.cs
New file
@@ -0,0 +1,42 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace WebAPI.Models
{
    public class ClsWW_EntrustProcessReportBillMain: DBUtility.ClsXt_BaseBillMain
    {
        /// <summary>
        /// HDeptID int  --部门ID(Gy_Department)
        /// </summary>
        public int? HDeptID { get; set; }//
        /// <summary>
        /// HSupID int    --供应商(Gy_Supplier)
        /// </summary>
        public int? HSupID { get; set; }//
        /// <summary>
        /// HEmpID int        --职员(Gy_Employee)
        /// </summary>
        public int? HEmpID { get; set; }//
        /// <summary>
        /// HExplanation varchar(500)   --摘要
        /// </summary>
        public string HExplanation { get; set; }//
        /// <summary>
        /// HInnerBillNo    varchar(50)   --内部单据号
        /// </summary>
        public string HInnerBillNo { get; set; }//
        /// <summary>
        /// HPrintQty            int                --打印次数
        /// </summary>
        public int? HPrintQty { get; set; }
    }
}
WebAPI/Models/ClsWW_EntrustProcessReportBillSub.cs
New file
@@ -0,0 +1,181 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace WebAPI.Models
{
    public class ClsWW_EntrustProcessReportBillSub : DBUtility.ClsXt_BaseBillSub
    {
        /// <summary>
        /// HBillNo_bak            varchar(50)            --单据号(备份,以免内码丢失,找不到对应主表)
        /// </summary>
        public string HBillNo_bak { get; set; }
        /// <summary>
        /// HProcID int        --工序 (gy_Process)
        /// </summary>
        public int HProcID { get; set; }
        /// <summary>
        ///    HSupFlag bit        --委外标记
        /// </summary>
        public bool HSupFlag { get; set; }
        /// <summary>
        ///   HMaterID            int      --产品ID(Gy_Material)
        /// </summary>
        public int HMaterID { get; set; }
        /// <summary>
        /// HTimes          money             --实作时间
        /// </summary>
        public double HTimes { get; set; }
        /// <summary>
        /// HQty             dec(18,8)         --实作数量
        /// </summary>
        public decimal HQty { get; set; }
        /// <summary>
        /// HCheckQty    dec(18,8)    --合格数量
        /// </summary>
        public decimal HCheckQty { get; set; }
        /// <summary>
        ///         HBadCount money           --不良品数
        /// </summary>
        public double HBadCount { get; set; }
        /// <summary>
        /// HWasterQty        money          --因工报废数量
        /// </summary>
        public double HWasterQty { get; set; }
        /// <summary>
        /// HWasterQty2        money          --因料报废数量
        /// </summary>
        public double HWasterQty2 { get; set; }
        /// <summary>
        /// HWeight     dec(18,8)           --重量 addnew
        /// </summary>
        public decimal HWeight { get; set; }
        /// <summary>
        /// HPrice dec(18,8)  --加工费
        /// </summary>
        public decimal HPrice { get; set; }
        /// <summary>
        /// HMoney       money      --  金额
        /// </summary>
        public double HMoney { get; set; }
        /// <summary>
        /// HBatchNo         varchar(100)   -- 批次
        /// </summary>
        public string HBatchNo { get; set; }
        /// <summary>
        /// HBadPrirce  money        --不良单价        --addnew
        /// </summary>
        public double HBadPrirce { get; set; }
        /// <summary>
        /// HBadMoney   money        --不良金额        --addnew
        /// </summary>
        public double HBadMoney { get; set; }
        /// <summary>
        /// HWasterPrice    money        --报废单价        --addnew
        /// </summary>
        public double HWasterPrice { get; set; }
        /// <summary>
        /// HWasterMoney    money        --报废金额        --addnew
        /// </summary>
        public double HWasterMoney { get; set; }
        /// <summary>
        /// HQualityRate money        --质量系数        --addnew
        /// </summary>
        public double HQualityRate { get; set; }
        /// <summary>
        ///  HUsingQty money        --让步数量        --addnew
        /// </summary>
        public double HUsingQty { get; set; }
        /// <summary>
        /// HSelfBadCount   money        --本道返工        --addnew
        /// </summary>
        public double HSelfBadCount { get; set; }
        /// <summary>
        ///       HPreBadCount    money        --前道不良数        --addnew
        /// </summary>
        public double HPreBadCount { get; set; }
        /// <summary>
        ///     HPayMentQty money        --结算数量        --addnew
        /// </summary>
        public double HPayMentQty { get; set; }
        /// <summary>
        ///  HPackType   varchar(50) --包装类型        --addnew
        /// </summary>
        public string HPackType { get; set; }
        /// <summary>
        ///    HCheckEmpID int        --检验员(gy_employee)  --addnew
        /// </summary>
        public int HCheckEmpID { get; set; }
        /// <summary>
        ///  HProcPlanInterID int        --工序计划单ID
        /// </summary>
        public int HProcPlanInterID { get; set; }
        /// <summary>
        ///  HProcPlanEntryID    int     --工序计划单子ID
        /// </summary>
        public int HProcPlanEntryID { get; set; }
        /// <summary>
        ///   HProcPlanBillNo    varchar(50)      --工序计划单号
        /// </summary>
        public string HProcPlanBillNo { get; set; }
        /// <summary>
        ///  HICMOInterID    int         --任务单ID
        /// </summary>
        public int HICMOInterID { get; set; }
        /// <summary>
        ///    HICMOEntryID    int         --任务单ID
        /// </summary>
        public int HICMOEntryID { get; set; }
        /// <summary>
        ///  HICMOBillNo     varchar(50)         --任务单号
        /// </summary>
        public string HICMOBillNo { get; set; }
        /// <summary>
        ///      HSeOrderInterID  int                 --销售订单主ID
        /// </summary>
        public int HSeOrderInterID { get; set; }
        /// <summary>
        ///   HSeOrderEntryID int                  --销售子ID
        /// </summary>
        public int HSeOrderEntryID { get; set; }
        /// <summary>
        ///    HSeOrderBillNo     varchar(50)        --销售订单号
        /// </summary>
        public string HSeOrderBillNo { get; set; }
    }
}
WebAPI/Models/ClsWW_EntrustProcessSendOutBillMain.cs
New file
@@ -0,0 +1,46 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace WebAPI.Models
{
    public class ClsWW_EntrustProcessSendOutBillMain : DBUtility.ClsXt_BaseBillMain
    {
        /// <summary>
        /// HPrintQty            int                --打印次数
        /// </summary>
        public Int64 HPrintQty { get; set; }
        /// <summary>
        /// HSupID int    --供应商(Gy_Supplier)
        /// </summary>
        public Int64 HSupID { get; set; }//
        /// <summary>
        /// HDeptID int          --部门ID(Gy_Department)
        /// </summary>
        public Int64 HDeptID { get; set; }
        /// <summary>
        ///    HSupID int        --供应商(Gy_Supplier)
        /// </summary>
        public Int64 MyProperty { get; set; }
        /// <summary>
        ///  HEmpID int        --职员(Gy_Employee)
        /// </summary>
        public Int64 HEmpID { get; set; }
        /// <summary>
        ///  HExplanation varchar(500)        --摘要
        /// </summary>
        public string HExplanation { get; set; }
        /// <summary>
        ///  HInnerBillNo        varchar(50)         --内部单据号
        /// </summary>
        public string HInnerBillNo { get; set; }
    }
}
WebAPI/Models/ClsWW_EntrustProcessSendOutBillSub.cs
New file
@@ -0,0 +1,102 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace WebAPI.Models
{
    public class ClsWW_EntrustProcessSendOutBillSub : DBUtility.ClsXt_BaseBillSub
    {
        /// <summary>
        /// HBillNo_bak            varchar(50)            --单据号(备份,以免内码丢失,找不到对应主表)
        /// </summary>
        public string HBillNo_bak { get; set; }
        /// <summary>
        /// HProcID int        --工序 (gy_Process)
        /// </summary>
        public Int64 HProcID { get; set; }
        /// <summary>
        ///  HSupFlag bit        --委外标记
        /// </summary>
        public bool HSupFlag { get; set; }
        /// <summary>
        ///  HMaterID            int      --产品ID(Gy_Material)
        /// </summary>
        public Int64 HMaterID { get; set; }
        /// <summary>
        ///  HQty dec(18,8)         --发出数量
        /// </summary>
        public decimal HQty { get; set; }
        /// <summary>
        ///  HPrice       dec(18,8)  --加工费
        /// </summary>
        public decimal HPrice { get; set; }
        /// <summary>
        /// HMoney       money      --  金额
        /// </summary>
        public double HMoney { get; set; }
        /// <summary>
        /// HBatchNo         varchar(100)   -- 批次
        /// </summary>
        public string HBatchNo { get; set; }
        /// <summary>
        ///      HPackType   varchar(50) --包装类型
        /// </summary>
        public string HPackType { get; set; }
        /// <summary>
        /// HProcPlanInterID int        --工序计划单ID
        /// </summary>
        public Int64 HProcPlanInterID { get; set; }
        /// <summary>
        /// HProcPlanEntryID    int     --工序计划单子ID
        /// </summary>
        public Int64 HProcPlanEntryID { get; set; }
        /// <summary>
        /// HProcPlanBillNo    varchar(50)      --工序计划单号
        /// </summary>
        public string HProcPlanBillNo { get; set; }
        /// <summary>
        /// HICMOInterID    int         --任务单ID
        /// </summary>
        public Int64 HICMOInterID { get; set; }
        /// <summary>
        ///
        /// </summary>
        public Int64 HICMOEntryID { get; set; }
        /// <summary>
        /// HICMOBillNo     varchar(50)         --任务单号
        /// </summary>
        public string HICMOBillNo { get; set; }
        /// <summary>
        /// HSeOrderInterID  int                 --销售订单主ID
        /// </summary>
        public Int64 HSeOrderInterID { get; set; }
        /// <summary>
        /// HSeOrderEntryID int                  --销售子ID
        /// </summary>
        public Int64 HSeOrderEntryID { get; set; }
        /// <summary>
        /// HSeOrderBillNo     varchar(50)        --销售订单号
        /// </summary>
        public string HSeOrderBillNo { get; set; }
    }
}
WebAPI/Models/WWReportViewModel.cs
New file
@@ -0,0 +1,66 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace WebAPI.Models
{
    public class WWReportViewModel
    {
        /// <summary>
        /// 条形码编码
        /// </summary>
        public string HBarCode;
        /// <summary>
        /// 委外派工单号
        /// </summary>
        public string HWW_BillNo;
        /// <summary>
        /// 委外汇报单号
        /// </summary>
        public string HBillNo;
        /// <summary>
        /// 工序号
        /// </summary>
        public string HProcNo;
        /// <summary>
        /// 工序id
        /// </summary>
        public string HProcID;
        /// <summary>
        /// 创建人id
        /// </summary>
        public string HEmpID;
        /// <summary>
        /// 数量
        /// </summary>
        public string HQty;
        /// <summary>
        /// 供应商id
        /// </summary>
        public string HSupID;
        /// <summary>
        /// 日期
        /// </summary>
        public string HReportTime;
        /// <summary>
        /// 产品id
        /// </summary>
        public string HMaterID;
        /// <summary>
        /// 部门id
        /// </summary>
        public string HDeptID;
    }
}
WebAPI/Models/WWSendOutBillViewModel.cs
New file
@@ -0,0 +1,65 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace WebAPI.Models
{
    public class WWSendOutBillViewModel
    {
        /// <summary>
        /// 条形码编码
        /// </summary>
        public string HBarCode;
        /// <summary>
        /// 委外派工单号
        /// </summary>
        public string HWW_BillNo;
        /// <summary>
        /// 委外转出单号
        /// </summary>
        public string HBillNo;
        /// <summary>
        /// 工序号
        /// </summary>
        public string HProcNo;
        /// <summary>
        /// 工序id
        /// </summary>
        public string HProcID;
        /// <summary>
        /// 创建人id
        /// </summary>
        public string HEmpID;
        /// <summary>
        /// 数量
        /// </summary>
        public string HQty;
        /// <summary>
        /// 供应商id
        /// </summary>
        public string HSupID;
        /// <summary>
        /// 日期
        /// </summary>
        public string HReportTime;
        /// <summary>
        /// 产品id
        /// </summary>
        public string HMaterID;
        /// <summary>
        /// 部门id
        /// </summary>
        public string HDeptID;
    }
}
WebAPI/Models/WW_EntrustProcSendWorkViewModel.cs
New file
@@ -0,0 +1,75 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace WebAPI.Models
{
    public class WW_EntrustProcSendWorkViewModel
    {
        public int? hmainid { get; set; }
        public DateTime? 日期 { get; set; }
        public string 单据号 { get; set; }
        public int? HDeptID { get; set; }
        public string 部门代码 { get; set; }
        public string 部门 { get; set; }
        public int? HMaterID { get; set; }
        public string 物料代码 { get; set; }
        public string 规格型号 { get; set; }
        public int? HUnitID { get; set; }
        public string 计量单位代码 { get; set; }
        public string 计量单位 { get; set; }
        public int? HSupID { get; set; }
        public string 供应商代码 { get; set; }
        public string 供应商名称 { get; set; }
        public int? HprocID { get; set; }
        public string 工序代码 { get; set; }
        public string 工序 { get; set; }
        public int? HGroupID { get; set; }
        public string 班组代码 { get; set; }
        public string 班组名称 { get; set; }
        public int? HSourceID { get; set; }
        public string 资源代码 { get; set; }
        public string 生产资源 { get; set; }
        public int HWorkerID { get; set; }
        public string 职员代码 { get; set; }
        public string 职员 { get; set; }
        public int? hsubid { get; set; }
        public double 数量 { get; set; }
        public DateTime? 计划开工日期 { get; set; }
        public DateTime? 计划完工日期 { get; set; }
        public double 计划工时 { get; set; }
        public string 表体备注 { get; set; }
        public int? HICMOInterID { get; set; }
        public string 生产任务单号 { get; set; }
        public int? HSeOrderInterID { get; set; }
        public string 销售订单号 { get; set; }
        public string 表头备注 { get; set; }
        public string 制单人 { get; set; }
        public DateTime? 制单日期 { get; set; }
        public string 审核人 { get; set; }
        public DateTime? 审核日期 { get; set; }
        public string 修改人 { get; set; }
        public DateTime? 修改日期 { get; set; }
        public string 关闭人 { get; set; }
        public DateTime? 关闭日期 { get; set; }
        public string 作废人 { get; set; }
        public DateTime? 作废日期 { get; set; }
        public int? 源单主内码 { get; set; }
        public int? 源单子内码 { get; set; }
        public string 源单单号 { get; set; }
        public string 源单类型 { get; set; }
        public string 行关闭人 { get; set; }
        public string HBillType { get; set; }
        public int? HQtyDecimal { get; set; }
        public int? HPriceDecimal { get; set; }
    }
}
WebAPI/Properties/PublishProfiles/API.pubxml.user
@@ -7,7 +7,7 @@
  <PropertyGroup>
    <TimeStampOfAssociatedLegacyPublishXmlFile />
    <_PublishTargetUrl>D:\网站发布\智云MESWMS\API</_PublishTargetUrl>
    <History>True|2021-05-06T10:11:36.9078607Z;True|2021-05-06T18:08:40.5403791+08:00;True|2021-05-06T18:07:04.1929681+08:00;True|2021-05-06T18:06:54.5987264+08:00;True|2021-05-06T18:05:46.1791578+08:00;True|2021-05-06T17:18:58.8131464+08:00;True|2021-05-06T17:18:37.9969968+08:00;True|2021-05-06T14:47:33.5704679+08:00;True|2021-05-06T10:03:28.7226576+08:00;True|2021-04-28T10:18:54.1336497+08:00;True|2021-04-27T16:34:19.0789205+08:00;True|2021-04-27T14:48:28.8138232+08:00;True|2021-04-27T10:34:03.6370089+08:00;True|2021-04-26T16:18:32.0260755+08:00;True|2021-04-26T15:00:58.6773071+08:00;True|2021-04-26T13:23:50.3968646+08:00;True|2021-04-16T08:50:41.5499248+08:00;True|2021-04-16T08:32:59.1701708+08:00;True|2021-04-16T08:27:36.9176335+08:00;True|2021-04-15T15:56:26.8485667+08:00;True|2021-04-15T15:21:23.2875671+08:00;True|2021-04-15T14:41:16.9980034+08:00;True|2021-04-15T14:36:34.8570017+08:00;True|2021-04-13T16:15:00.7668503+08:00;</History>
    <History>True|2021-05-08T11:04:07.1084339Z;True|2021-05-08T18:04:40.2166839+08:00;True|2021-05-08T18:04:32.5635574+08:00;True|2021-05-08T18:01:24.5206432+08:00;True|2021-05-08T17:38:05.5582200+08:00;True|2021-05-08T15:26:55.2861241+08:00;True|2021-05-08T14:52:13.1682476+08:00;True|2021-05-08T14:50:30.5356438+08:00;True|2021-05-08T14:38:40.3445313+08:00;True|2021-05-08T14:38:37.9504757+08:00;True|2021-05-08T14:30:31.9762236+08:00;True|2021-05-08T14:21:37.4496495+08:00;True|2021-05-07T20:47:46.1401919+08:00;True|2021-05-07T20:31:45.7777162+08:00;True|2021-05-07T20:31:35.2882424+08:00;True|2021-05-07T20:31:21.5616729+08:00;False|2021-05-07T20:29:33.8855457+08:00;False|2021-05-07T20:28:43.1845420+08:00;False|2021-05-07T20:28:13.1335411+08:00;True|2021-05-07T20:10:01.7346568+08:00;True|2021-05-07T20:03:17.0005596+08:00;True|2021-05-07T09:05:04.3102029+08:00;True|2021-05-06T18:11:36.9078607+08:00;True|2021-05-06T18:08:40.5403791+08:00;True|2021-05-06T18:07:04.1929681+08:00;True|2021-05-06T18:06:54.5987264+08:00;True|2021-05-06T18:05:46.1791578+08:00;True|2021-05-06T17:18:58.8131464+08:00;True|2021-05-06T17:18:37.9969968+08:00;True|2021-05-06T14:47:33.5704679+08:00;True|2021-05-06T10:03:28.7226576+08:00;True|2021-04-28T10:18:54.1336497+08:00;True|2021-04-27T16:34:19.0789205+08:00;True|2021-04-27T14:48:28.8138232+08:00;True|2021-04-27T10:34:03.6370089+08:00;True|2021-04-26T16:18:32.0260755+08:00;True|2021-04-26T15:00:58.6773071+08:00;True|2021-04-26T13:23:50.3968646+08:00;True|2021-04-16T08:50:41.5499248+08:00;True|2021-04-16T08:32:59.1701708+08:00;True|2021-04-16T08:27:36.9176335+08:00;True|2021-04-15T15:56:26.8485667+08:00;True|2021-04-15T15:21:23.2875671+08:00;True|2021-04-15T14:41:16.9980034+08:00;True|2021-04-15T14:36:34.8570017+08:00;True|2021-04-13T16:15:00.7668503+08:00;</History>
  </PropertyGroup>
  <ItemGroup>
    <File Include="apiapp.json">
@@ -19,6 +19,12 @@
    </File>
    <File Include="bin/Antlr3.Runtime.pdb">
      <publishTime>02/22/2013 08:43:40</publishTime>
    </File>
    <File Include="bin/App_global.asax.compiled">
      <publishTime>05/07/2021 20:31:20</publishTime>
    </File>
    <File Include="bin/App_global.asax.dll">
      <publishTime>05/07/2021 20:31:20</publishTime>
    </File>
    <File Include="bin/BLL.dll">
      <publishTime>01/13/2021 21:47:30</publishTime>
@@ -165,10 +171,10 @@
      <publishTime>11/24/2014 11:18:48</publishTime>
    </File>
    <File Include="bin/WebAPI.dll">
      <publishTime>05/10/2021 08:40:19</publishTime>
      <publishTime>05/08/2021 19:03:59</publishTime>
    </File>
    <File Include="bin/WebAPI.pdb">
      <publishTime>05/10/2021 08:40:19</publishTime>
      <publishTime>05/08/2021 19:03:59</publishTime>
    </File>
    <File Include="bin/WebAPI.XmlSerializers.dll">
      <publishTime>02/04/2021 21:35:21</publishTime>
@@ -244,6 +250,9 @@
    </File>
    <File Include="packages.config">
      <publishTime>01/21/2021 13:19:40</publishTime>
    </File>
    <File Include="PrecompiledApp.config">
      <publishTime>05/07/2021 20:31:19</publishTime>
    </File>
    <File Include="Views/Scripts/bootstrap.js">
      <publishTime>01/13/2021 21:47:30</publishTime>
@@ -342,7 +351,7 @@
      <publishTime>02/22/2021 09:25:20</publishTime>
    </File>
    <File Include="Web.config">
      <publishTime>05/10/2021 08:40:34</publishTime>
      <publishTime>05/08/2021 19:04:06</publishTime>
    </File>
  </ItemGroup>
</Project>
WebAPI/Service/LuBaoSevice.cs
@@ -11,7 +11,7 @@
    {
        /// <summary>
        /// 扫码方法
        /// 工序汇报扫码方法
        /// </summary>
        public static ApiResult<DataSet> GetHbarCodeDetail(string sBillBarCode)
        {
@@ -27,7 +27,28 @@
        public static DataSet GetBarCodeDb(string billBarCode)
        {
            SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
            var dataSet = oCN.RunProcReturn("select top 1 * from h_v_Sc_ProcessSendWorkList  where 单据号= '" + billBarCode + "'", "h_v_Sc_ProcessSendWorkList");
            var dataSet = oCN.RunProcReturn("select top 1 * from h_v_Sc_ProcessSendWorkList  where HBillType='3712' and  单据号= '" + billBarCode + "'", "h_v_Sc_ProcessSendWorkList");
            return dataSet;
        }
        /// <summary>
        /// 委外工序汇报扫码方法
        /// </summary>
        public static ApiResult<DataSet> WWGetHbarCodeDetail(string sBillBarCode)
        {
            if (string.IsNullOrEmpty(sBillBarCode))
                return new ApiResult<DataSet> { code = -1, msg = "条码不能为空" };
            sBillBarCode = sBillBarCode.CompareTo("#") > 0 ? sBillBarCode.Split(Convert.ToChar("#"))[0] : sBillBarCode;
            var dataSet = WWGetBarCodeDb(sBillBarCode);
            if (dataSet == null || dataSet.Tables[0].Rows.Count == 0)
                return new ApiResult<DataSet> { code = -1, msg = "不存在委外派工单号" };
            return new ApiResult<DataSet> { code = 1, msg = "查询成功", data = dataSet };
        }
        public static DataSet WWGetBarCodeDb(string billBarCode)
        {
            SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
            var dataSet = oCN.RunProcReturn("select top 1 * from h_v_WW_EntrustProcSendWorkBillList  where HBillType='3740' and 单据号= '" + billBarCode + "'", "h_v_WW_EntrustProcSendWorkBillList");
            return dataSet;
        }
@@ -47,10 +68,29 @@
        public static DataSet GetProcDb(string sBillNo, string sProcNo)
        {
            SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
            var dataSet = oCN.RunProcReturn("select top 1 * from h_v_Sc_ProcessSendWorkList  where 单据号= '" + sBillNo + "' and HprocID='" + sProcNo + "'", "h_v_Sc_ProcessSendWorkList");
            var dataSet = oCN.RunProcReturn("select top 1 * from h_v_Sc_ProcessSendWorkList  where HBillType='3712' and  单据号= '" + sBillNo + "' and HprocID='" + sProcNo + "'", "h_v_Sc_ProcessSendWorkList");
            return dataSet;
        }
        /// <summary>
        /// PDA委外汇报单回车方法
        /// </summary>
        public static ApiResult<DataSet> WWGetProcDetail(string sBillNo, string sProcNo)
        {
            if (string.IsNullOrEmpty(sBillNo) || string.IsNullOrEmpty(sProcNo))
                return new ApiResult<DataSet> { code = -1, msg = "条码和流转卡不能为空" };
            var dataSet = WWGetProcDb(sBillNo, sProcNo);
            if (dataSet == null || dataSet.Tables[0].Rows.Count == 0)
                return new ApiResult<DataSet> { code = -1, msg = "流水号或流转卡号为空" };
            return new ApiResult<DataSet> { code = 1, msg = "查询成功", data = dataSet };
        }
        public static DataSet WWGetProcDb(string sBillNo, string sProcNo)
        {
            SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
            var dataSet = oCN.RunProcReturn("select top 1 * from h_v_WW_EntrustProcSendWorkBillList  where HBillType='3740' and  单据号= '" + sBillNo + "' and HprocID='" + sProcNo + "'", "h_v_WW_EntrustProcSendWorkBillList");
            return dataSet;
        }
    }
}
WebAPI/WebAPI.csproj
@@ -360,9 +360,15 @@
    <Compile Include="DLL\ClsQC_NoPassProdCheckBill.cs" />
    <Compile Include="DLL\ClsSc_ProcessReport.cs" />
    <Compile Include="DLL\ClsSc_ProcessSendWork.cs" />
    <Compile Include="DLL\ClsWW_EntrustProcessReportBill.cs" />
    <Compile Include="DLL\ClsWW_EntrustProcessSendOutBill.cs" />
    <Compile Include="Models\ApiConfig.cs" />
    <Compile Include="Models\ApiResult.cs" />
    <Compile Include="Models\ClsSc_ProcessSendWorkMain.cs" />
    <Compile Include="Models\ClsWW_EntrustProcessReportBillMain.cs" />
    <Compile Include="Models\ClsWW_EntrustProcessReportBillSub.cs" />
    <Compile Include="Models\ClsWW_EntrustProcessSendOutBillMain.cs" />
    <Compile Include="Models\ClsWW_EntrustProcessSendOutBillSub.cs" />
    <Compile Include="Models\DocumentsView.cs" />
    <Compile Include="Models\Gy_RoutingBillSub.cs" />
    <Compile Include="Models\LookingForBill.cs" />
@@ -377,6 +383,9 @@
    <Compile Include="Models\Gy_RoutingBill.cs" />
    <Compile Include="Models\StationBill.cs" />
    <Compile Include="Models\StationOutBillView.cs" />
    <Compile Include="Models\WWReportViewModel.cs" />
    <Compile Include="Models\WWSendOutBillViewModel.cs" />
    <Compile Include="Models\WW_EntrustProcSendWorkViewModel.cs" />
    <Compile Include="Models\WW_EntrustWorkOrderViewModel.cs" />
    <Compile Include="Properties\Resources.Designer.cs">
      <AutoGen>True</AutoGen>