能够实现多人扫码出库,材料匹配生成的任务单,排序需要一致,退货入库导入,匹配管线正在出库中管线不统计散件出库

This commit is contained in:
2025-01-23 15:52:33 +08:00
parent 718467e9f9
commit 0ff22e7876
13 changed files with 124 additions and 40 deletions
@@ -110,9 +110,28 @@ namespace BLL
{ {
var table = db.HJGL_PackagingManage.FirstOrDefault(x => x.PackagingManageId == packagingManageId); var table = db.HJGL_PackagingManage.FirstOrDefault(x => x.PackagingManageId == packagingManageId);
if (table != null) if (table != null)
{
if (string.IsNullOrEmpty(table.PipelineComponentId))
{ {
table.PipelineComponentId = PipelineComponentIds; table.PipelineComponentId = PipelineComponentIds;
} }
else
{
HashSet<string> set = new HashSet<string>();
string[] oldIds = table.PipelineComponentId.Split(',');
foreach (var id in oldIds)
{
set.Add(id);
}
string[] newIds = PipelineComponentIds.Split(',');
foreach (var id in newIds)
{
set.Add(id);
}
table.PipelineComponentId = string.Join(",", set);
}
}
BLL.HJGL_PackagingmanageService.UpdateHJGL_PackagingManage(table); BLL.HJGL_PackagingmanageService.UpdateHJGL_PackagingManage(table);
} }
@@ -178,6 +178,7 @@ namespace BLL
join master in db.Tw_InOutPlanMaster on x.InOutPlanMasterId equals master.Id join master in db.Tw_InOutPlanMaster on x.InOutPlanMasterId equals master.Id
join y in db.HJGL_MaterialCodeLib on x.MaterialCode equals y.MaterialCode join y in db.HJGL_MaterialCodeLib on x.MaterialCode equals y.MaterialCode
join z in db.HJGL_Pipeline on x.PipelineId equals z.PipelineId join z in db.HJGL_Pipeline on x.PipelineId equals z.PipelineId
join t in db.HJGL_WeldTask on master.WeldTaskId equals t.WeldTaskId
where x.InOutPlanMasterId == outPlanMasterId where x.InOutPlanMasterId == outPlanMasterId
select new Tw_PipeMatMatchOutput select new Tw_PipeMatMatchOutput
{ {
@@ -191,6 +192,7 @@ namespace BLL
MaterialUnit = y.MaterialUnit, MaterialUnit = y.MaterialUnit,
MaterialDef = y.MaterialDef, MaterialDef = y.MaterialDef,
NeedNum = x.Number, NeedNum = x.Number,
PipeLineSortIndex=t.PipeLineSortIndex
} }
).ToList(); ).ToList();
var masterModle = db.Tw_InOutPlanMaster.FirstOrDefault(x => x.Id == outPlanMasterId); var masterModle = db.Tw_InOutPlanMaster.FirstOrDefault(x => x.Id == outPlanMasterId);
@@ -4,6 +4,7 @@ using System;
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Runtime.CompilerServices;
using System.Text; using System.Text;
@@ -82,9 +83,10 @@ namespace BLL
public static Model.Tw_InOutPlanDetail_Relation GetByPipelineId(string pipelineId,string WarehouseCode) public static Model.Tw_InOutPlanDetail_Relation GetByPipelineId(string pipelineId,string WarehouseCode)
{ {
int typeInt = (int)TwConst.TypeInt.;
var q= from x in Funs.DB.Tw_InOutPlanDetail_Relation var q= from x in Funs.DB.Tw_InOutPlanDetail_Relation
join y in Funs.DB .Tw_InOutPlanMaster on x.InOutPlanMasterId equals y.Id join y in Funs.DB .Tw_InOutPlanMaster on x.InOutPlanMasterId equals y.Id
where x.PipelineId == pipelineId && y.WarehouseCode == WarehouseCode where x.PipelineId == pipelineId && y.WarehouseCode == WarehouseCode && y.TypeInt!= typeInt
select x; select x;
return q.FirstOrDefault(); return q.FirstOrDefault();
} }
+57 -13
View File
@@ -87,7 +87,9 @@ namespace BLL
AuditDate2 = x.AuditDate2, AuditDate2 = x.AuditDate2,
WarehouseMan = x.WarehouseMan, WarehouseMan = x.WarehouseMan,
WarehouseDate = x.WarehouseDate, WarehouseDate = x.WarehouseDate,
WarehouseManName= warehouseperson.PersonName WarehouseManName= warehouseperson.PersonName,
PipeLineSortIndex=y.PipeLineSortIndex
} }
; ;
@@ -145,7 +147,8 @@ namespace BLL
AuditDate2 = x.AuditDate2, AuditDate2 = x.AuditDate2,
WarehouseMan = x.WarehouseMan, WarehouseMan = x.WarehouseMan,
WarehouseDate = x.WarehouseDate, WarehouseDate = x.WarehouseDate,
WarehouseManName= x.WarehouseManName WarehouseManName= x.WarehouseManName,
PipeLineSortIndex = x.PipeLineSortIndex,
}).ToList(); }).ToList();
} }
@@ -281,6 +284,15 @@ namespace BLL
return responeData; return responeData;
} }
} }
var typeString = temeplateDtoIns.Select(x => x.TypeString).Distinct().ToList(); //获取导入文件的材料编码
if (typeString.Contains("采购入库") && typeString.Contains("退料入库"))
{
responeData.code = 0;
responeData.message = errorWarehouseCode + "每次只能导入一种类型!";
return responeData;
}
var materialCodeList = temeplateDtoIns.Select(x => x.MaterialCode).Distinct().ToList(); //获取导入文件的材料编码 var materialCodeList = temeplateDtoIns.Select(x => x.MaterialCode).Distinct().ToList(); //获取导入文件的材料编码
var IsExitMaterialCode= var IsExitMaterialCode=
from x in Funs.DB.HJGL_MaterialCodeLib from x in Funs.DB.HJGL_MaterialCodeLib
@@ -296,7 +308,7 @@ namespace BLL
return responeData; return responeData;
} }
} }
string cusbilcode = GetDataInCusBillCode(projectid,UnitService.GetUnitCodeByUnitId(Person_PersonsService.GetPerson_PersonsById(creatUserId).UnitId)); string cusbilcode = GetDataInCusBillCode(projectid,UnitService.GetUnitCodeByUnitId(Person_PersonsService.GetPerson_PersonsById(creatUserId).UnitId), temeplateDtoIns.FirstOrDefault().TypeString);
foreach (var item in temeplateDtoIns) foreach (var item in temeplateDtoIns)
{ {
item.CusBillCode = cusbilcode; item.CusBillCode = cusbilcode;
@@ -320,7 +332,7 @@ namespace BLL
foreach (var CusBillCode in CusBillCodeList) foreach (var CusBillCode in CusBillCodeList)
{ {
var CusBillCodeDtoIns = temeplateDtoIns.Where(x => x.CusBillCode == CusBillCode).ToList(); var CusBillCodeDtoIns = temeplateDtoIns.Where(x => x.CusBillCode == CusBillCode).ToList();
var FirstCusBillCodeDtoIns = temeplateDtoIns.FirstOrDefault(x => x.CusBillCode == CusBillCode);
var mapper = var mapper =
ObjectMapperManager.DefaultInstance.GetMapper<List<Tw_InputDataIn>, List<Model.Tw_InOutPlanMaster>>(); ObjectMapperManager.DefaultInstance.GetMapper<List<Tw_InputDataIn>, List<Model.Tw_InOutPlanMaster>>();
var mapperDetail = var mapperDetail =
@@ -332,7 +344,21 @@ namespace BLL
twInOutPlanMaster.Id = SQLHelper.GetNewID(); twInOutPlanMaster.Id = SQLHelper.GetNewID();
twInOutPlanMaster.InOutType= (int)TwConst.InOutType.; twInOutPlanMaster.InOutType= (int)TwConst.InOutType.;
twInOutPlanMaster.State = (int)TwConst.State.; twInOutPlanMaster.State = (int)TwConst.State.;
twInOutPlanMaster.TypeInt= (int)TwConst.TypeInt.;
if ("采购入库".Equals(FirstCusBillCodeDtoIns.TypeString))
{
twInOutPlanMaster.TypeInt = (int)TwConst.TypeInt.;
}
else if ("退料入库".Equals(FirstCusBillCodeDtoIns.TypeString))
{
twInOutPlanMaster.TypeInt = (int)TwConst.TypeInt.退;
}
else
{
twInOutPlanMaster.TypeInt = (int)TwConst.TypeInt.;
}
twInOutPlanMaster.Category= (int)TwConst.Category.; twInOutPlanMaster.Category= (int)TwConst.Category.;
twInOutPlanMaster.ProjectId = projectid; twInOutPlanMaster.ProjectId = projectid;
twInOutPlanMaster.CreateMan = creatUserId; twInOutPlanMaster.CreateMan = creatUserId;
@@ -514,7 +540,11 @@ namespace BLL
planMasterModel.InOutType= (int)TwConst.InOutType.; planMasterModel.InOutType= (int)TwConst.InOutType.;
break; break;
case TwConst.TypeInt.退: case TwConst.TypeInt.退:
planMasterModel.CusBillCode = GetCusBillCodeByTaskCode(outMaster.WeldTaskCode, TwConst.TypeInt.退, (BLL.TwConst.Category)planMasterModel.Category); string pre = "";
pre += DateTime.Now.ToString("yyyyMMdd");
pre += UnitService.GetUnitCodeByUnitId(outMaster.ReqUnitId);
pre += "-"+ UnitWorkService.getUnitWorkByUnitWorkId(outMaster.UnitWorkId)?.UnitWorkCode;
planMasterModel.CusBillCode = GetCusBillCodeByTaskCode(pre , TwConst.TypeInt.退, (BLL.TwConst.Category)planMasterModel.Category);
planMasterModel.TypeInt = (int)TwConst.TypeInt.退; planMasterModel.TypeInt = (int)TwConst.TypeInt.退;
planMasterModel.InOutType = (int)TwConst.InOutType.; planMasterModel.InOutType = (int)TwConst.InOutType.;
; ;
@@ -556,11 +586,11 @@ namespace BLL
case TwConst.TypeInt.退: case TwConst.TypeInt.退:
if (category == TwConst.Category.) if (category == TwConst.Category.)
{ {
cusBillCode = taskCode + "-GI-P01-RE01"; cusBillCode = taskCode + "-GI-P01-RE01-GR01";
} }
else if (category == TwConst.Category.) else if (category == TwConst.Category.)
{ {
cusBillCode = taskCode + "-GI-PF01-RE01"; cusBillCode = taskCode + "-GI-PF01-RE01-GR01";
} }
break; break;
@@ -569,20 +599,34 @@ namespace BLL
} }
public static string GetDataInCusBillCode(string projectid, string unitcode) public static string GetDataInCusBillCode(string projectid, string unitcode,string typeString)
{
if (typeString == TwConst.TypeInt.退.ToString())
{ {
//生成规则是20240919-unitcode-AP-GR01 //生成规则是20240919-unitcode-AP-GR01
string cusBillCode = string.Format("{0:yyyyMMdd}", DateTime.Now) + "-"+unitcode + "-AP-GR"; string cusBillCode = string.Format("{0:yyyyMMdd}", DateTime.Now) + "-" + unitcode + "-AP-GR";
var queryAll = new Tw_InOutMasterOutput() var queryAll = new Tw_InOutMasterOutput()
{ {
ProjectId = projectid, ProjectId = projectid,
CusBillCode=cusBillCode, CusBillCode = cusBillCode,
}; };
var queryAllresult = GetModle(queryAll).Count(); var queryAllresult = GetModle(queryAll).Count();
cusBillCode = cusBillCode + (queryAllresult + 1).ToString().PadLeft(2, '0'); cusBillCode = cusBillCode + (queryAllresult + 1).ToString().PadLeft(2, '0');
return cusBillCode; return cusBillCode;
}
else
{
//生成规则是20240919-unitcode-AP-GR01
string cusBillCode = string.Format("{0:yyyyMMdd}", DateTime.Now) + "-" + unitcode + "-AP-GR";
var queryAll = new Tw_InOutMasterOutput()
{
ProjectId = projectid,
CusBillCode = cusBillCode,
};
var queryAllresult = GetModle(queryAll).Count();
cusBillCode = cusBillCode + (queryAllresult + 1).ToString().PadLeft(2, '0');
return cusBillCode;
}
} }
/// <summary> /// <summary>
+2 -2
View File
@@ -101,7 +101,7 @@
<f:Grid ID="Grid1" ShowBorder="true" ShowHeader="false" Title="申请单" IsFluid="true" <f:Grid ID="Grid1" ShowBorder="true" ShowHeader="false" Title="申请单" IsFluid="true"
EnableCollapse="true" runat="server" BoxFlex="1" DataKeyNames="Id" EnableCollapse="true" runat="server" BoxFlex="1" DataKeyNames="Id"
EnableColumnLines="true" ClicksToEdit="2" DataIDField="Id" EnableColumnLines="true" ClicksToEdit="2" DataIDField="Id"
AllowSorting="true" SortField="CusBillCode" SortDirection="ASC" OnSort="Grid1_Sort" OnRowCommand="Grid1_RowCommand" AllowSorting="true" SortField="PipeLineSortIndex" SortDirection="ASC" OnSort="Grid1_Sort" OnRowCommand="Grid1_RowCommand"
EnableTextSelection="True" EnableRowClickEvent="true" OnRowClick="Grid1_RowClick" EnableRowGroup="true" DataRowGroupField="WeldTaskCode"> EnableTextSelection="True" EnableRowClickEvent="true" OnRowClick="Grid1_RowClick" EnableRowGroup="true" DataRowGroupField="WeldTaskCode">
<Columns> <Columns>
<f:TemplateField ColumnID="tfNumber" Width="50px" HeaderText="序号" HeaderTextAlign="Center" <f:TemplateField ColumnID="tfNumber" Width="50px" HeaderText="序号" HeaderTextAlign="Center"
@@ -200,7 +200,7 @@
<Items> <Items>
<f:Grid ID="Grid3" ShowBorder="False" ShowHeader="False" Title="管线材料明细" EnableCollapse="true" ForceFit="true" <f:Grid ID="Grid3" ShowBorder="False" ShowHeader="False" Title="管线材料明细" EnableCollapse="true" ForceFit="true"
runat="server" BoxFlex="1" DataKeyNames="Id" runat="server" BoxFlex="1" DataKeyNames="Id"
ClicksToEdit="2" DataIDField="Id" AllowSorting="true" SortField="MaterialCode" ExpandAllRowGroups="false" ClicksToEdit="2" DataIDField="Id" AllowSorting="true" SortField="PipeLineSortIndex,MaterialCode" ExpandAllRowGroups="false"
SortDirection="DESC" EnableRowGroup="true" DataRowGroupField="PipelineCode" AllowPaging="true" IsDatabasePaging="true" PageSize="10000" RowGroupRendererFunction="onGrid3RowGroupRenderer"> SortDirection="DESC" EnableRowGroup="true" DataRowGroupField="PipelineCode" AllowPaging="true" IsDatabasePaging="true" PageSize="10000" RowGroupRendererFunction="onGrid3RowGroupRenderer">
<Columns> <Columns>
<f:RenderField Width="100px" ColumnID="PipelineCode" DataField="PipelineCode" SortField="PipelineCode" <f:RenderField Width="100px" ColumnID="PipelineCode" DataField="PipelineCode" SortField="PipelineCode"
@@ -85,7 +85,7 @@ namespace FineUIPro.Web.CLGL
txtCreateMan.Text = this.CurrUser.PersonName; txtCreateMan.Text = this.CurrUser.PersonName;
txtCreateDate.Text = DateTime.Now.ToString("yyyy-MM-dd"); txtCreateDate.Text = DateTime.Now.ToString("yyyy-MM-dd");
drpReqUnit.SelectedValue = this.CurrUser.UnitId; drpReqUnit.SelectedValue = this.CurrUser.UnitId;
txtCusBillCode.Text = TwInOutplanmasterService.GetDataInCusBillCode(this.CurrUser.LoginProjectId, UnitService.GetUnitByUnitId(this.CurrUser.UnitId)?.UnitCode); txtCusBillCode.Text = TwInOutplanmasterService.GetDataInCusBillCode(this.CurrUser.LoginProjectId, UnitService.GetUnitByUnitId(this.CurrUser.UnitId)?.UnitCode, drpTypeInt.SelectedText);
} }
drpTypeInt_SelectedIndexChanged(null, null); drpTypeInt_SelectedIndexChanged(null, null);
@@ -392,12 +392,12 @@ namespace FineUIPro.Web.HJGL.WeldingManage
Grid3.DataBind(); Grid3.DataBind();
for (int i = 0; i < Grid3.Rows.Count; i++) for (int i = 0; i < Grid3.Rows.Count; i++)
{ {
var model = Grid3.Rows[i].DataItem ; var model = Grid3.Rows[i].DataItem;
var model2= JsonConvert.DeserializeObject<Dictionary<string, string>>(JsonConvert.SerializeObject(model)); var model2 = JsonConvert.DeserializeObject<Dictionary<string, string>>(JsonConvert.SerializeObject(model));
string pipeid= model2.First().Value; string pipeid = model2.First().Value;
var relationModle=TwInoutplandetailRelationService.GetByPipelineId(pipeid,WarehouseCode); var relationModle = TwInoutplandetailRelationService.GetByPipelineId(pipeid, WarehouseCode);
if (relationModle!= null) if (relationModle != null)
{ {
Grid3.Rows[i].RowCssClass = "yellow"; Grid3.Rows[i].RowCssClass = "yellow";
} }
@@ -61,7 +61,7 @@
<f:Grid ID="Grid1" ShowBorder="true" ShowHeader="false" Title="焊接任务单" ForceFit="true" <f:Grid ID="Grid1" ShowBorder="true" ShowHeader="false" Title="焊接任务单" ForceFit="true"
EnableCollapse="true" runat="server" BoxFlex="1" DataKeyNames="WeldTaskId,WeldJointId" EnableColumnLines="true" EnableCollapse="true" runat="server" BoxFlex="1" DataKeyNames="WeldTaskId,WeldJointId" EnableColumnLines="true"
AllowCellEditing="true" ClicksToEdit="1" DataIDField="WeldTaskId" AllowSorting="true" AllowCellEditing="true" ClicksToEdit="1" DataIDField="WeldTaskId" AllowSorting="true"
SortField="PipelineCode,WeldJointCode" SortDirection="ASC" OnSort="Grid1_Sort" SortField="PipeLineSortIndex" SortDirection="ASC" OnSort="Grid1_Sort"
AllowPaging="false" IsDatabasePaging="true" PageSize="10000" EnableTextSelection="True" AllowPaging="false" IsDatabasePaging="true" PageSize="10000" EnableTextSelection="True"
EnableCheckBoxSelect="true" KeepCurrentSelection="true"> EnableCheckBoxSelect="true" KeepCurrentSelection="true">
<Toolbars> <Toolbars>
@@ -141,7 +141,10 @@
DataField="Size" SortField="Size" FieldType="Double" HeaderTextAlign="Center" TextAlign="Left" DataField="Size" SortField="Size" FieldType="Double" HeaderTextAlign="Center" TextAlign="Left"
Width="70px"> Width="70px">
</f:RenderField> </f:RenderField>
<f:RenderField HeaderText="排序" ColumnID="PipeLineSortIndex" Hidden="true"
DataField="PipeLineSortIndex" SortField="PipeLineSortIndex" FieldType="Int" HeaderTextAlign="Center" TextAlign="Left"
Width="70px">
</f:RenderField>
<f:RenderField HeaderText="壁厚" ColumnID="Thickness" Hidden="true" <f:RenderField HeaderText="壁厚" ColumnID="Thickness" Hidden="true"
DataField="Thickness" SortField="Thickness" FieldType="Double" HeaderTextAlign="Center" DataField="Thickness" SortField="Thickness" FieldType="Double" HeaderTextAlign="Center"
TextAlign="Left" Width="70px"> TextAlign="Left" Width="70px">
@@ -235,7 +235,7 @@ namespace FineUIPro.Web.HJGL.WeldingManage
where x.UnitWorkId == node.NodeID where x.UnitWorkId == node.NodeID
&& x.TaskDate < Convert.ToDateTime(this.txtTaskDateMonth.Text.Trim() + "-01").AddMonths(1) && x.TaskDate < Convert.ToDateTime(this.txtTaskDateMonth.Text.Trim() + "-01").AddMonths(1)
&& x.TaskDate >= Convert.ToDateTime(this.txtTaskDateMonth.Text.Trim() + "-01") && x.TaskDate >= Convert.ToDateTime(this.txtTaskDateMonth.Text.Trim() + "-01")
select new { x.TaskDate.Value.Date, x.UnitId,x.SerialNumber }).Distinct().ToList().OrderByDescending(x => x.Date); select new { x.TaskDate.Value.Date, x.UnitId,x.SerialNumber, x.PipeLineSortIndex }).Distinct().ToList().OrderBy(x => x.PipeLineSortIndex);
if (p.Count() > 0) if (p.Count() > 0)
{ {
foreach (var item in p) foreach (var item in p)
@@ -255,7 +255,7 @@ namespace FineUIPro.Web.HJGL.WeldingManage
join y in Funs.DB.HJGL_WeldJoint on x.WeldJointId equals y.WeldJointId join y in Funs.DB.HJGL_WeldJoint on x.WeldJointId equals y.WeldJointId
where x.UnitWorkId == node.NodeID && y.WeldJointCode.Contains(this.txtWeldJointCode.Text.Trim()) where x.UnitWorkId == node.NodeID && y.WeldJointCode.Contains(this.txtWeldJointCode.Text.Trim())
orderby x.TaskDate descending orderby x.TaskDate descending
select new { x.TaskDate.Value.Date, x.UnitId, x.SerialNumber }).Distinct().ToList().OrderByDescending(x => x.Date); select new { x.TaskDate.Value.Date, x.UnitId, x.SerialNumber ,x.PipeLineSortIndex}).Distinct().ToList().OrderBy(x => x.PipeLineSortIndex);
if (p.Count() > 0) if (p.Count() > 0)
{ {
foreach (var item in p) foreach (var item in p)
@@ -894,6 +894,10 @@ namespace FineUIPro.Web.HJGL.WeldingManage
{ {
NewItem.Dia = values.Value<int>("Dia"); NewItem.Dia = values.Value<int>("Dia");
} }
if (!string.IsNullOrEmpty(values.Value<string>("PipeLineSortIndex")) && !string.IsNullOrEmpty(values.Value<int>("PipeLineSortIndex").ToString()))
{
NewItem.PipeLineSortIndex = values.Value<int>("PipeLineSortIndex");
}
if (!string.IsNullOrEmpty(values.Value<int>("Thickness").ToString())) if (!string.IsNullOrEmpty(values.Value<int>("Thickness").ToString()))
{ {
NewItem.Thickness = values.Value<int>("Thickness"); NewItem.Thickness = values.Value<int>("Thickness");
@@ -902,6 +906,7 @@ namespace FineUIPro.Web.HJGL.WeldingManage
{ {
NewItem.WeldingMethodCode = values.Value<string>("WeldingMethodCode").ToString(); NewItem.WeldingMethodCode = values.Value<string>("WeldingMethodCode").ToString();
} }
getNewWeldTaskItem.Add(NewItem); getNewWeldTaskItem.Add(NewItem);
} }
+2
View File
@@ -19,5 +19,7 @@ namespace Model
public string ReqUnitName { get; set; } public string ReqUnitName { get; set; }
public string UnitWorkId { get; set; } public string UnitWorkId { get; set; }
public string WeldTaskCode { get; set; } public string WeldTaskCode { get; set; }
public int? PipeLineSortIndex { get; set; }
} }
} }
+5
View File
@@ -20,5 +20,10 @@ namespace Model
/// 数量 /// 数量
/// </summary> /// </summary>
[ExcelColumnIndex("C")] public string PlanNum { get; set; } [ExcelColumnIndex("C")] public string PlanNum { get; set; }
/// <summary>
/// 类型
/// </summary>
[ExcelColumnIndex("D")] public string TypeString { get; set; }
} }
} }
+2
View File
@@ -25,6 +25,8 @@ namespace Model
public decimal? MatchNum { get; set; } public decimal? MatchNum { get; set; }
public decimal? MatchRate { get; set; } public decimal? MatchRate { get; set; }
public string MatchRateString { get; set; } public string MatchRateString { get; set; }
public int? PipeLineSortIndex { get; set; }
} }
public class Tw_PipeMatchOutput public class Tw_PipeMatchOutput
{ {