服务端的TigerApi 框架,基于.NET6 2024 版本
Rodney Chen
2024-09-25 2420648a1522c2e1cd8138bb43dd7d46a6561a1a
厂内码客户码绑定增加包装工单和成品料号
已修改7个文件
104 ■■■■ 文件已修改
Tiger.Business.MES/Transaction/Position.cs 43 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Tiger.Business.MES/WorkAction/PackageInputCheck.cs 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Tiger.Business.MES/WorkAction/PackingAction.cs 21 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Tiger.Business.MES/WorkAction/ThreeInOne.cs 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Tiger.Business.MES/iERP/U9C_MES.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
Tiger.Business.MESTests/MesTests.cs 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Tiger.Model.Net/Entitys/MES/MES_CUST_SN.cs 20 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Tiger.Business.MES/Transaction/Position.cs
@@ -11,6 +11,7 @@
using Tiger.Model;
using static Tiger.Business.Biz;
using Tiger.Model.Entitys.MES.Position;
using System.Globalization;
namespace Tiger.Business.MES.Transaction
{
@@ -579,6 +580,48 @@
            return result;
        }
        /// <summary>
        /// 根据包装工单和条码获取华为要求的生产周期
        /// </summary>
        /// <param name="snList"></param>
        /// <returns></returns>
        private string GetHuaWeiWeek(string pkgOrder, List<string> snList)
        {
            Dictionary<string, string> dic = new();
            var snOrder = Biz.Db.Queryable<MES_CUST_SN, BIZ_MES_WO>((q, w) => new JoinQueryInfos(JoinType.Left, q.WORK_ORDER == w.ORDER_NO))
                                            .Where((q, w) => q.PKG_ORDER == pkgOrder && (snList.Contains(q.FLOW_SN) || snList.Contains(q.CUST_SN)))
                                           .Select((q, w) => new { q.PKG_ORDER, q.WORK_ORDER, w.ACT_START_TIME, w.PLAN_START_TIME, q.FLOW_SN, q.CUST_SN }).ToList();
            foreach (var sn in snList)
            {
                var item = snOrder.FirstOrDefault(q => q.FLOW_SN == sn || q.CUST_SN == sn);
                if (!item.IsNullOrEmpty())
                {
                    var date = item.ACT_START_TIME < new DateTime(2000, 1, 1) ? item.PLAN_START_TIME : item.ACT_START_TIME; ;
                    var firstDay = new DateTime(date.Year, 1, 1);
                    int daysOffset = firstDay.DayOfWeek.GetValue() > 3 ? (firstDay.DayOfWeek.GetValue() - 7) : 0;
                    int year = date.Year + ((date - firstDay).TotalDays + daysOffset < 0 ? -1 : 0);
                    int week = CultureInfo.CurrentCulture.Calendar.GetWeekOfYear(date, CalendarWeekRule.FirstFourDayWeek, DayOfWeek.Sunday);
                    dic.Add(sn, $"{year.ToString().Substring(2, 2)}{week:00}");
                }
                else
                {
                    dic.Add(sn, "");
                }
            }
            var weeks = dic.Select(q => q.Value).Where(q => !q.IsNullOrEmpty()).Distinct().OrderBy(q => q).ToList();
            switch (weeks.Count)
            {
                case 0:
                    return "";
                case 1:
                    return weeks.First();
                case 2:
                    return string.Join("/", weeks.Select(q => q + $"({dic.Count(d => d.Value == q)})"));
                default:
                    return string.Join("/", weeks.Take(2)) + " (+)";
            }
        }
        #endregion
        #endregion Functions
Tiger.Business.MES/WorkAction/PackageInputCheck.cs
@@ -190,8 +190,8 @@
            //更新厂内流程码
            FlowCSN.CUST_CODE = CurPosition.WorkBatch.WO.CUST_CODE;
            FlowCSN.WORK_ORDER = CurPosition.WorkBatch.WO.ORDER_NO;
            FlowCSN.ITEM_CODE = CurPosition.WorkBatch.WO.ITEM_CODE;
            FlowCSN.PKG_ORDER = CurPosition.WorkBatch.WO.ORDER_NO;
            FlowCSN.PROD_CODE = CurPosition.WorkBatch.WO.ITEM_CODE;
            //记录行为操作记录
            var wipActs = new List<MES_WIP_ACT>();
Tiger.Business.MES/WorkAction/PackingAction.cs
@@ -748,6 +748,27 @@
            return list;
        }
        public List<MES_WIP_PKG> GetMinPackageList(WipPkgItem parent)
        {
            List<MES_WIP_PKG> list = new();
            if (parent.Items.Any())
            {
                foreach (var item in parent.Items)
                {
                    item.Package.PARENT_SN = parent.Package?.SN;
                    list.AddRange(GetMinPackageList(item));
                }
            }
            else
            {
                if (!parent.Package.IsNullOrEmpty())
                {
                    list.Add(parent.Package);
                }
            }
            return list;
        }
        public ApiAction<SubmitOutput> CompletePkg()
        {
            var action = new ApiAction<SubmitOutput>(new SubmitOutput());
Tiger.Business.MES/WorkAction/ThreeInOne.cs
@@ -326,8 +326,8 @@
            //更新厂内流程码
            FlowCSN.CUST_CODE = CurPosition.WorkBatch.WO.CUST_CODE;
            FlowCSN.WORK_ORDER = CurPosition.WorkBatch.WO.ORDER_NO;
            FlowCSN.ITEM_CODE = CurPosition.WorkBatch.WO.ITEM_CODE;
            FlowCSN.PKG_ORDER = CurPosition.WorkBatch.WO.ORDER_NO;
            FlowCSN.PROD_CODE = CurPosition.WorkBatch.WO.ITEM_CODE;
            //记录行为操作记录
            var wipActs = new List<MES_WIP_ACT>();
Tiger.Business.MES/iERP/U9C_MES.cs
@@ -176,7 +176,7 @@
                            ITEM_CODE = basItem != null ? basItem.ITEM_CODE : "",
                            CREATE_TIME = di["CreatedOn"].ToDateTime(),
                            UPDATE_TIME = di["ModifiedOn"].ToDateTime(),
                            PLAN_START_TIME = di["CheckDate"].ToDateTime(),
                            PLAN_START_TIME = di["CreatedOn"].ToDateTime(),
                            STATUS = 0,
                            AUTH_ORG = orgs.Where(x => x.ID == orgId).Select(q => q.ORG_CODE).FirstOrDefault(),
                            SALES_ORDER = di["SrcDoc_SrcDocNo"] == null ? "" : di["SrcDoc_SrcDocNo"].ToString(),
Tiger.Business.MESTests/MesTests.cs
@@ -1,4 +1,5 @@
using System;
using Rhea.Common;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
@@ -13,8 +14,13 @@
        [TestMethod()]
        public void CommonTest()
        {
            var date = new DateTime(2022,1,1);
            var date = new DateTime(2021,1,2);
            var firstDay = new DateTime(date.Year, 1, 1);
            int daysOffset = firstDay.DayOfWeek.GetValue() > 3 ? (firstDay.DayOfWeek.GetValue() - 7) : 0;
            int year = date.Year + ((date - firstDay).TotalDays + daysOffset < 0 ? -1 : 0);
            int week = CultureInfo.CurrentCulture.Calendar.GetWeekOfYear(date, CalendarWeekRule.FirstFourDayWeek, DayOfWeek.Sunday);
            var str = $"{year.ToString().Substring(2, 2)}{week:00}";
            ;
        }
    }
Tiger.Model.Net/Entitys/MES/MES_CUST_SN.cs
@@ -36,19 +36,29 @@
        /// <summary>
        /// 厂内流转条码(若是导入的未绑定客户条码,此字段为空)
        /// </summary>
        [DisplayName("厂内流转条码")]
        [DisplayName("厂内流转条码(若是导入的未绑定客户条码,此字段为空)")]
        public string FLOW_SN { get; set; }
        /// <summary>
        /// 工单号
        /// 生产工单号
        /// </summary>
        [DisplayName("工单号")]
        [DisplayName("生产工单号")]
        public string WORK_ORDER { get; set; }
        /// <summary>
        /// 物料编码
        /// 半成品物料编码
        /// </summary>
        [DisplayName("物料编码")]
        [DisplayName("半成品物料编码")]
        public string ITEM_CODE { get; set; }
        /// <summary>
        /// 包装工单号
        /// </summary>
        [DisplayName("包装工单号")]
        public string PKG_ORDER { get; set; }
        /// <summary>
        /// 成品物料编码
        /// </summary>
        [DisplayName("成品物料编码")]
        public string PROD_CODE { get; set; }
        /// <summary>
        /// 备注
        /// </summary>
        [DisplayName("备注")]