WYB
2021-04-06 7953aa09d09ed7889f8806f1e4fe2ccc18c1f548
工序计划单下推-保存逻辑编写
4个文件已修改
1个文件已添加
223 ■■■■■ 已修改文件
WebAPI/Controllers/Sc_ProcessMangementController.cs 111 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/ListModels.cs 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Models/Sc_ProcessPlanViewModel.cs 89 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Properties/PublishProfiles/API.pubxml.user 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/WebAPI.csproj 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Controllers/Sc_ProcessMangementController.cs
@@ -215,15 +215,114 @@
            try
            {
                DAL.ClsSc_ProcessSendWork dal = new DAL.ClsSc_ProcessSendWork();
                DAL.ClsSc_ProcessSendWork Sendwork = new DAL.ClsSc_ProcessSendWork();
                List<Model.ClsSc_ProcessSendWorkMain> lsmain = new List<Model.ClsSc_ProcessSendWorkMain>();
                msg2 = msg2.Replace("\\", "");
                msg2 = msg2.Replace("\n", "");
                lsmain = oListModels.getObjectByJson_SendWorkMain(msg2);
                foreach ( Model.ClsSc_ProcessSendWorkMain  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;
                    if (DBUtility.ClsPub.isStrNull(oItem.HPlanBeginDate) == "")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "保存失败!没有填写计划开工日期,无法保存!";
                        objJsonResult.data = 1;
                        return objJsonResult;
                    }
                    Sendwork.omodel = oItem;
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "保存成功!";
                objJsonResult.data = 1;
                return objJsonResult;
                }
                //表体数据
                //按 },{来拆分数组 //去掉【和】
                msg3 = msg3.Substring(1, msg3.Length - 2);
                msg3 = msg3.Replace("\\", "");
                msg3 = msg3.Replace("\n", "");  //\n
                List<WebAPI.Models.Sc_ProcessPlanViewModel> ls = new List<WebAPI.Models.Sc_ProcessPlanViewModel>();
                ls = oListModels.getObjectByJson_SendWorkSub(msg3);
                int i = 0;
                Model.ClsSc_ProcessSendWorkSub sendworksub = new Model.ClsSc_ProcessSendWorkSub();
                foreach (WebAPI.Models.Sc_ProcessPlanViewModel oItemSub in ls)
                {
                    //foreach (var item in collection)
                    //{
                    //}
                    //i++;
                    //if (oItemSub.HQty <= 0)
                    //{
                    //    objJsonResult.code = "0";
                    //    objJsonResult.count = 0;
                    //    objJsonResult.Message = "保存失败!第" + i.ToString() + "行数量不大于0无法保存!";
                    //    objJsonResult.data = 1;
                    //    return objJsonResult;
                    //}
                    //if (oItemSub.HQty > oItemSub.HRelationQty)
                    //{
                    //    objJsonResult.code = "0";
                    //    objJsonResult.count = 0;
                    //    objJsonResult.Message = "保存失败!第" + i.ToString() + "行数量不能大于未关联数量!";
                    //    objJsonResult.data = 1;
                    //    return objJsonResult;
                    //}
                    //if (DBUtility.ClsPub.isStrNull(oItemSub.HBatChNo) == "")
                    //{
                    //    objJsonResult.code = "0";
                    //    objJsonResult.count = 0;
                    //    objJsonResult.Message = "保存失败!第" + i.ToString() + "行未填写批号!";
                    //    objJsonResult.data = 1;
                    //    return objJsonResult;
                    //}
                    //oItemSub.HEntryID = i;
                    //oItemSub.HEntryCloseDate = DBUtility.ClsPub.isDate(DateTime.Now);
                    //oItemSub.HRemark = "";
                    //oItemSub.HCloseMan = "";
                    //oItemSub.HCloseType = false;
                    //Sendwork.DetailColl.Add(oItemSub);
                }
                //保存
                //保存完毕后处理
                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)
            {
WebAPI/ListModels.cs
@@ -139,5 +139,21 @@
            List<Model.ClsKf_OtherOutBillMain> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsKf_OtherOutBillMain>>(jsonString);
            return list;
        }
        public List<Model.ClsSc_ProcessSendWorkMain> getObjectByJson_SendWorkMain(string jsonString)
        {
            jsonString = "[" + jsonString.ToString() + "]";
            List<Model.ClsSc_ProcessSendWorkMain> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsSc_ProcessSendWorkMain>>(jsonString);
            return list;
        }
        public List<WebAPI.Models.Sc_ProcessPlanViewModel> getObjectByJson_SendWorkSub(string jsonString)
        {
            jsonString = "[" + jsonString.ToString() + "]";
            List<WebAPI.Models.Sc_ProcessPlanViewModel> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<WebAPI.Models.Sc_ProcessPlanViewModel>>(jsonString);
            return list;
        }
    }
}
WebAPI/Models/Sc_ProcessPlanViewModel.cs
New file
@@ -0,0 +1,89 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace WebAPI.Models
{
    public class Sc_ProcessPlanViewModel
    {
//      [hmainid],
//[日期],
// [单据号],
//[HMaterID],
// [物料代码],
//[物料名称],
//[规格型号],
//[单位],
//[hunitid],
//[计量单位代码],
//[计量单位],
//[生产数量],
//[计划开工日期],
//[计划完工日期],
//[摘要],
//[表头备注],
//[内部单据号],
//[hicmointerid],
//[任务单号],
//[制单人],
//[制单日期],
//[审核人],
//[审核日期],
//[修改人],
//[修改日期],
//[关闭人],
//[关闭日期],
// [关闭类型],
//[作废人],
// [作废日期],
//[hsubid],
// [工序计划单号],
// [工序号],
// [hprocid],
//[工序代码],
// [工序],
//[加工说明],
//[开工固天],
// [开工固数],
// [HCenterID],
// [工作中心代码],
// [工作中心],
//[HDeptID],
//[加工车间代码],
//[加工车间],
// [HGroupID],
//[班组代码],
//[班组名称],
//[HWorkerID],
//[操作员代码],
//[操作员],
// [HSourceID],
//[资源代码],
//[生产资源],
//[计划数量],
//[关联数量],
//[时间单位],
//[计划加工时间],
//[工序计划开工日期],
//[工序计划完工日期],
//[准备时间],
//[排队时间],
//[转移时间],
//[表体备注],
// [批次],
//[源单主内码],
//[源单子内码],
//[源单单号],
//[源单类型],
//[销售订单主ID],
//[销售订单子ID],
//[销售订单号],
//[HBillType],
// [单据类型],
//[HBillSubType],
//[HQtyDecimal],
// [HPriceDecimal]
    }
}
WebAPI/Properties/PublishProfiles/API.pubxml.user
@@ -157,10 +157,10 @@
      <publishTime>11/24/2014 11:18:48</publishTime>
    </File>
    <File Include="bin/WebAPI.dll">
      <publishTime>04/01/2021 08:46:56</publishTime>
      <publishTime>04/06/2021 11:06:14</publishTime>
    </File>
    <File Include="bin/WebAPI.pdb">
      <publishTime>04/01/2021 08:46:56</publishTime>
      <publishTime>04/06/2021 11:06:14</publishTime>
    </File>
    <File Include="bin/WebAPI.XmlSerializers.dll">
      <publishTime>02/04/2021 21:35:21</publishTime>
@@ -334,7 +334,7 @@
      <publishTime>03/26/2021 14:35:48</publishTime>
    </File>
    <File Include="Web.config">
      <publishTime>04/01/2021 15:08:43</publishTime>
      <publishTime>04/06/2021 11:11:08</publishTime>
    </File>
  </ItemGroup>
</Project>
WebAPI/WebAPI.csproj
@@ -345,6 +345,7 @@
    <Compile Include="Models\M_ProcMul.cs" />
    <Compile Include="Models\M_StationBillMail.cs" />
    <Compile Include="Models\M_Process.cs" />
    <Compile Include="Models\Sc_ProcessPlanViewModel.cs" />
    <Compile Include="Models\StationOutBillView.cs" />
    <Compile Include="Properties\Resources.Designer.cs">
      <AutoGen>True</AutoGen>