代码无效引用清理,试压包资料界面看板修改
This commit is contained in:
@@ -1,78 +1,73 @@
|
||||
|
||||
using Model;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Media.Animation;
|
||||
|
||||
namespace BLL
|
||||
namespace BLL
|
||||
{
|
||||
public class TwArrivalStatisticsService
|
||||
{
|
||||
public static List<Tw_ArrivalStatisticsOutPut> GetStatistics(string projectid,string materialCode,string WarehouseCode)
|
||||
public static List<Tw_ArrivalStatisticsOutPut> GetStatistics(string projectid, string materialCode, string WarehouseCode)
|
||||
{
|
||||
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
|
||||
{
|
||||
string PipeArea= WarehouseCode == "工厂预制"?"1":"2";
|
||||
string PipeArea = WarehouseCode == "工厂预制" ? "1" : "2";
|
||||
///所需材料数量列表
|
||||
var NeedOutMateriaList = from x in db.HJGL_PipeLineMat
|
||||
join y in db.HJGL_MaterialCodeLib on x.MaterialCode equals y.MaterialCode
|
||||
join z in db.HJGL_Pipeline on x.PipelineId equals z.PipelineId
|
||||
where z.ProjectId == projectid && (string.IsNullOrEmpty(materialCode) || x.MaterialCode .Contains( materialCode)) && z.PipeArea== PipeArea
|
||||
join y in db.HJGL_MaterialCodeLib on x.MaterialCode equals y.MaterialCode
|
||||
join z in db.HJGL_Pipeline on x.PipelineId equals z.PipelineId
|
||||
where z.ProjectId == projectid && (string.IsNullOrEmpty(materialCode) || x.MaterialCode.Contains(materialCode)) && z.PipeArea == PipeArea
|
||||
group x by x.MaterialCode
|
||||
into g
|
||||
select new
|
||||
{
|
||||
g.Key,
|
||||
NeedNum = g.Sum(x => x.Number) ?? 0,
|
||||
};
|
||||
select new
|
||||
{
|
||||
g.Key,
|
||||
NeedNum = g.Sum(x => x.Number) ?? 0,
|
||||
};
|
||||
///实际材料入库数量列表
|
||||
var RealInMateriaList = from x in db.Tw_InputDetail
|
||||
join master in db.Tw_InputMaster on x.InputMasterId equals master.Id
|
||||
join y in db.HJGL_MaterialCodeLib on x.MaterialCode equals y.MaterialCode
|
||||
where master.ProjectId== projectid && master.WarehouseCode== WarehouseCode
|
||||
join y in db.HJGL_MaterialCodeLib on x.MaterialCode equals y.MaterialCode
|
||||
where master.ProjectId == projectid && master.WarehouseCode == WarehouseCode
|
||||
group x by x.MaterialCode
|
||||
into g
|
||||
where (string.IsNullOrEmpty(materialCode) || g.Key.Contains( materialCode))
|
||||
where (string.IsNullOrEmpty(materialCode) || g.Key.Contains(materialCode))
|
||||
select new
|
||||
{
|
||||
g.Key,
|
||||
RealNum = g.Sum(x => x.ActNum) ?? 0,
|
||||
};
|
||||
//库存数量
|
||||
var tw_MaterialStock=from x in db.Tw_MaterialStock
|
||||
where x.WarehouseCode==WarehouseCode && x.ProjectId== projectid
|
||||
select x;
|
||||
var tw_MaterialStock = from x in db.Tw_MaterialStock
|
||||
where x.WarehouseCode == WarehouseCode && x.ProjectId == projectid
|
||||
select x;
|
||||
|
||||
|
||||
var StatisticsList =(from x in NeedOutMateriaList
|
||||
join y in RealInMateriaList on x.Key equals y.Key into gg
|
||||
from y in gg.DefaultIfEmpty()
|
||||
join z in db.HJGL_MaterialCodeLib on x.Key equals z.MaterialCode into zz
|
||||
from z in zz.DefaultIfEmpty()
|
||||
join m in tw_MaterialStock on x.Key equals m.PipeLineMatCode into mm
|
||||
from m in mm.DefaultIfEmpty()
|
||||
select new Tw_ArrivalStatisticsOutPut
|
||||
{
|
||||
MaterialCode = x.Key,
|
||||
StockNum = m==null?0: (decimal)m.StockNum,
|
||||
NeedNum = x.NeedNum,
|
||||
RealNum = y==null?0:y.RealNum,
|
||||
MaterialName = z.MaterialName,
|
||||
MaterialSpec=z.MaterialSpec,
|
||||
MaterialUnit=z.MaterialUnit,
|
||||
MaterialDef = z.MaterialDef,
|
||||
MatchRate = (x.NeedNum == 0 ?0:Math.Round((y == null ? 0 : y.RealNum) / x.NeedNum, 4,MidpointRounding.ToEven)),
|
||||
}).ToList();
|
||||
var StatisticsList = (from x in NeedOutMateriaList
|
||||
join y in RealInMateriaList on x.Key equals y.Key into gg
|
||||
from y in gg.DefaultIfEmpty()
|
||||
join z in db.HJGL_MaterialCodeLib on x.Key equals z.MaterialCode into zz
|
||||
from z in zz.DefaultIfEmpty()
|
||||
join m in tw_MaterialStock on x.Key equals m.PipeLineMatCode into mm
|
||||
from m in mm.DefaultIfEmpty()
|
||||
select new Tw_ArrivalStatisticsOutPut
|
||||
{
|
||||
MaterialCode = x.Key,
|
||||
StockNum = m == null ? 0 : (decimal)m.StockNum,
|
||||
NeedNum = x.NeedNum,
|
||||
RealNum = y == null ? 0 : y.RealNum,
|
||||
MaterialName = z.MaterialName,
|
||||
MaterialSpec = z.MaterialSpec,
|
||||
MaterialUnit = z.MaterialUnit,
|
||||
MaterialDef = z.MaterialDef,
|
||||
MatchRate = (x.NeedNum == 0 ? 0 : Math.Round((y == null ? 0 : y.RealNum) / x.NeedNum, 4, MidpointRounding.ToEven)),
|
||||
}).ToList();
|
||||
foreach (var item in StatisticsList)
|
||||
{
|
||||
item.MatchRateString = Math.Round(item.MatchRate*100, 2).ToString()+"%" ;
|
||||
}
|
||||
return StatisticsList ;
|
||||
item.MatchRateString = Math.Round(item.MatchRate * 100, 2).ToString() + "%";
|
||||
}
|
||||
return StatisticsList;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -83,8 +78,8 @@ namespace BLL
|
||||
/// <param name="warehouseCode"></param>
|
||||
/// <param name="projectId"></param>
|
||||
/// <returns></returns>
|
||||
public static List<Tw_PipeMatMatchOutput> GetMatMatchOutput(List<Tw_PipeMatMatchOutput> requiredMaterials ,string warehouseCode ,string projectId)
|
||||
{
|
||||
public static List<Tw_PipeMatMatchOutput> GetMatMatchOutput(List<Tw_PipeMatMatchOutput> requiredMaterials, string warehouseCode, string projectId)
|
||||
{
|
||||
Tw_MaterialStockOutput twMaterialStockOutput = new Tw_MaterialStockOutput
|
||||
{
|
||||
WarehouseCode = warehouseCode,
|
||||
@@ -113,11 +108,11 @@ namespace BLL
|
||||
if (stock != null)
|
||||
{
|
||||
stock.StockNum -= material.MatchNum;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
var results = requiredMaterials;
|
||||
return results;
|
||||
return results;
|
||||
}
|
||||
/// <summary>
|
||||
/// 获取管线匹配率
|
||||
@@ -127,7 +122,7 @@ namespace BLL
|
||||
public static decimal? GetPipeMatch(string pipelineId)
|
||||
{
|
||||
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
|
||||
{
|
||||
{
|
||||
var twPipeMatMatchOutputs = new List<Tw_PipeMatMatchOutput>();
|
||||
var pipelineModel = PipelineService.GetPipelineByPipelineId(pipelineId);
|
||||
string warehouseCode = PipelineService
|
||||
@@ -138,7 +133,7 @@ namespace BLL
|
||||
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 m in db.WBS_UnitWork on z.UnitWorkId equals m.UnitWorkId
|
||||
where z.PipelineId== pipelineId && x.PrefabricatedComponents != "" //x.PrefabricatedComponents!="" 用于筛选非散件材料
|
||||
where z.PipelineId == pipelineId && x.PrefabricatedComponents != "" //x.PrefabricatedComponents!="" 用于筛选非散件材料
|
||||
select new Tw_PipeMatMatchOutput
|
||||
{
|
||||
Id = Guid.NewGuid().ToString(),
|
||||
@@ -154,10 +149,10 @@ namespace BLL
|
||||
MaterialDef = y.MaterialDef,
|
||||
NeedNum = x.Number,
|
||||
}
|
||||
).ToList();
|
||||
|
||||
twPipeMatMatchOutputs = GetMatMatchOutput(requiredMaterials, warehouseCode, pipelineModel.ProjectId);
|
||||
var result = twPipeMatMatchOutputs.Count==0?0: twPipeMatMatchOutputs.Sum(x=>x.MatchRate)/ twPipeMatMatchOutputs.Count;
|
||||
).ToList();
|
||||
|
||||
twPipeMatMatchOutputs = GetMatMatchOutput(requiredMaterials, warehouseCode, pipelineModel.ProjectId);
|
||||
var result = twPipeMatMatchOutputs.Count == 0 ? 0 : twPipeMatMatchOutputs.Sum(x => x.MatchRate) / twPipeMatMatchOutputs.Count;
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@@ -170,29 +165,29 @@ namespace BLL
|
||||
{
|
||||
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
|
||||
{
|
||||
var results = new List<Tw_PipeMatMatchOutput>();
|
||||
string [] taskPipeLineList= null;
|
||||
var results = new List<Tw_PipeMatMatchOutput>();
|
||||
string[] taskPipeLineList = null;
|
||||
|
||||
var inoutPlanMasterl = db.Tw_InOutPlanMaster.FirstOrDefault(x => x.Id == outPlanMasterId);
|
||||
if (inoutPlanMasterl!=null)
|
||||
if (inoutPlanMasterl != null)
|
||||
{
|
||||
if (inoutPlanMasterl.WeldTaskId.Split('|').Length==4)
|
||||
{
|
||||
taskPipeLineList = Funs.DB.View_HJGL_WeldingTask.Where(e =>
|
||||
e.UnitWorkId == inoutPlanMasterl.WeldTaskId.Split('|')[0].ToString()
|
||||
&& e.UnitId == inoutPlanMasterl.WeldTaskId.Split('|')[1].ToString()
|
||||
&& e.TaskDate.Value.Date == DateTime
|
||||
.ParseExact(inoutPlanMasterl.WeldTaskId.Split('|')[2].ToString(), "yyyyMMdd", null).Date
|
||||
&& e.SerialNumber == inoutPlanMasterl.WeldTaskId.Split('|')[3].ToString()
|
||||
).Distinct().OrderBy(x => x.PipeLineSortIndex).Select(x => x.PipelineId).ToArray();
|
||||
if (inoutPlanMasterl.WeldTaskId.Split('|').Length == 4)
|
||||
{
|
||||
taskPipeLineList = Funs.DB.View_HJGL_WeldingTask.Where(e =>
|
||||
e.UnitWorkId == inoutPlanMasterl.WeldTaskId.Split('|')[0].ToString()
|
||||
&& e.UnitId == inoutPlanMasterl.WeldTaskId.Split('|')[1].ToString()
|
||||
&& e.TaskDate.Value.Date == DateTime
|
||||
.ParseExact(inoutPlanMasterl.WeldTaskId.Split('|')[2].ToString(), "yyyyMMdd", null).Date
|
||||
&& e.SerialNumber == inoutPlanMasterl.WeldTaskId.Split('|')[3].ToString()
|
||||
).Distinct().OrderBy(x => x.PipeLineSortIndex).Select(x => x.PipelineId).ToArray();
|
||||
}
|
||||
}
|
||||
// 获取所需材料列表
|
||||
var requiredMaterials = (from x in db.Tw_InOutPlanDetail_Relation
|
||||
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 z in db.HJGL_Pipeline on x.PipelineId equals z.PipelineId
|
||||
where x.InOutPlanMasterId == outPlanMasterId
|
||||
join z in db.HJGL_Pipeline on x.PipelineId equals z.PipelineId
|
||||
where x.InOutPlanMasterId == outPlanMasterId
|
||||
select new Tw_PipeMatMatchOutput
|
||||
{
|
||||
Id = Guid.NewGuid().ToString(),
|
||||
@@ -213,7 +208,7 @@ namespace BLL
|
||||
|
||||
}
|
||||
|
||||
var masterModle = db.Tw_InOutPlanMaster.FirstOrDefault(x => x.Id == outPlanMasterId);
|
||||
var masterModle = db.Tw_InOutPlanMaster.FirstOrDefault(x => x.Id == outPlanMasterId);
|
||||
results = GetMatMatchOutput(requiredMaterials, masterModle.WarehouseCode, masterModle.ProjectId);
|
||||
return results;
|
||||
}
|
||||
@@ -259,7 +254,7 @@ namespace BLL
|
||||
foreach (string id in pipelineIds)
|
||||
{
|
||||
newRequiredMaterials.AddRange(requiredMaterials.Where(x => x.PipelineId == id));
|
||||
}
|
||||
}
|
||||
results = GetMatMatchOutput(newRequiredMaterials, warehouseCode, projectId);
|
||||
return results;
|
||||
}
|
||||
|
||||
@@ -4,8 +4,6 @@ using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Text;
|
||||
|
||||
|
||||
namespace BLL
|
||||
@@ -33,7 +31,7 @@ namespace BLL
|
||||
(string.IsNullOrEmpty(table.PipelineId) || x.PipelineId.Contains(table.PipelineId)) &&
|
||||
(string.IsNullOrEmpty(table.InOutPlanMasterId) || x.InOutPlanMasterId.Contains(table.InOutPlanMasterId)) &&
|
||||
(string.IsNullOrEmpty(table.MaterialCode) || x.MaterialCode.Contains(table.MaterialCode)) &&
|
||||
(string.IsNullOrEmpty(table.PrefabricatedComponents) || x.PrefabricatedComponents.Contains(table.PrefabricatedComponents))
|
||||
(string.IsNullOrEmpty(table.PrefabricatedComponents) || x.PrefabricatedComponents.Contains(table.PrefabricatedComponents))
|
||||
select x
|
||||
;
|
||||
|
||||
@@ -58,7 +56,7 @@ namespace BLL
|
||||
// q = SortConditionHelper.SortingAndPaging(q, Grid1.SortField, Grid1.SortDirection, Grid1.PageIndex, Grid1.PageSize);
|
||||
return from x in q
|
||||
join y in Funs.DB.HJGL_Pipeline on x.PipelineId equals y.PipelineId
|
||||
join mat in Funs.DB.HJGL_MaterialCodeLib on x.MaterialCode equals mat.MaterialCode into mm
|
||||
join mat in Funs.DB.HJGL_MaterialCodeLib on x.MaterialCode equals mat.MaterialCode into mm
|
||||
from mat in mm.DefaultIfEmpty()
|
||||
orderby x.PipelineId, x.PrefabricatedComponents
|
||||
select new
|
||||
@@ -70,7 +68,7 @@ namespace BLL
|
||||
x.MaterialCode,
|
||||
x.PrefabricatedComponents,
|
||||
x.Number,
|
||||
mat.MaterialName,
|
||||
mat.MaterialName,
|
||||
mat.MaterialDef
|
||||
};
|
||||
}
|
||||
@@ -81,14 +79,14 @@ namespace BLL
|
||||
return Funs.DB.Tw_InOutPlanDetail_Relation.FirstOrDefault(x => x.Id == Id);
|
||||
}
|
||||
|
||||
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
|
||||
join y in Funs.DB .Tw_InOutPlanMaster on x.InOutPlanMasterId equals y.Id
|
||||
where x.PipelineId == pipelineId && y.WarehouseCode == WarehouseCode && y.TypeInt!= typeInt
|
||||
select x;
|
||||
return q.FirstOrDefault();
|
||||
var q = from x in Funs.DB.Tw_InOutPlanDetail_Relation
|
||||
join y in Funs.DB.Tw_InOutPlanMaster on x.InOutPlanMasterId equals y.Id
|
||||
where x.PipelineId == pipelineId && y.WarehouseCode == WarehouseCode && y.TypeInt != typeInt
|
||||
select x;
|
||||
return q.FirstOrDefault();
|
||||
}
|
||||
public static void Add(Model.Tw_InOutPlanDetail_Relation newtable)
|
||||
{
|
||||
@@ -156,14 +154,14 @@ namespace BLL
|
||||
Funs.DB.SubmitChanges();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static void InsertByPipeLineMat(string inOutPlanMasterId, List<Model.Tw_PipeLineMat> tw_PipeLineMats)
|
||||
{
|
||||
var master =TwInOutplanmasterService.GetById(inOutPlanMasterId);
|
||||
var master = TwInOutplanmasterService.GetById(inOutPlanMasterId);
|
||||
if (master == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
var outMateriaList = from x in tw_PipeLineMats
|
||||
group x by new { x.MaterialCode, x.MaterialUnit }
|
||||
into g
|
||||
@@ -183,7 +181,7 @@ namespace BLL
|
||||
outMateriaList.Where(x => x.MaterialName.Contains("个"));//管件
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
foreach (var item in outMateriaList)
|
||||
{
|
||||
Model.Tw_InOutPlanDetail detail = new Model.Tw_InOutPlanDetail
|
||||
@@ -206,27 +204,27 @@ namespace BLL
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static IEnumerable GetPrintListByOutputMasterIds(List<string> outputMasterIds)
|
||||
{
|
||||
var q = from x in Funs.DB.Tw_InOutPlanDetail_Relation
|
||||
join y in Funs.DB.HJGL_MaterialCodeLib on x.MaterialCode equals y.MaterialCode
|
||||
join plan in Funs.DB.Tw_InOutPlanMaster on x.InOutPlanMasterId equals plan.Id
|
||||
join plan in Funs.DB.Tw_InOutPlanMaster on x.InOutPlanMasterId equals plan.Id
|
||||
join master in Funs.DB.Tw_OutputMaster on plan.Id equals master.InOutPlanMasterId
|
||||
join pipe in Funs.DB.HJGL_Pipeline on x.PipelineId equals pipe.PipelineId
|
||||
where outputMasterIds.Contains(master.Id)
|
||||
orderby master.CusBillCode
|
||||
select new
|
||||
{
|
||||
出库单编号 = master.CusBillCode,
|
||||
管线号=pipe.PipelineCode,
|
||||
预制组件号= x.PrefabricatedComponents,
|
||||
材料编码 = x.MaterialCode,
|
||||
材料名称 = y.MaterialName,
|
||||
材料描述 = y.MaterialDef,
|
||||
单位=y.MaterialUnit,
|
||||
所需量 = x.Number,
|
||||
};
|
||||
orderby master.CusBillCode
|
||||
select new
|
||||
{
|
||||
出库单编号 = master.CusBillCode,
|
||||
管线号 = pipe.PipelineCode,
|
||||
预制组件号 = x.PrefabricatedComponents,
|
||||
材料编码 = x.MaterialCode,
|
||||
材料名称 = y.MaterialName,
|
||||
材料描述 = y.MaterialDef,
|
||||
单位 = y.MaterialUnit,
|
||||
所需量 = x.Number,
|
||||
};
|
||||
return q;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@ using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
|
||||
namespace BLL
|
||||
@@ -11,7 +10,7 @@ namespace BLL
|
||||
|
||||
public static class TwInOutplandetailService
|
||||
{
|
||||
|
||||
|
||||
#region 获取列表
|
||||
/// <summary>
|
||||
/// 记录数
|
||||
@@ -30,14 +29,14 @@ namespace BLL
|
||||
from mat in mm.DefaultIfEmpty()
|
||||
join master in Funs.DB.Tw_InOutPlanMaster on x.InOutPlanMasterId equals master.Id into masters
|
||||
from master in masters.DefaultIfEmpty()
|
||||
join stock in Funs.DB.Tw_MaterialStock on new { x.MaterialCode, master.WarehouseCode,master.ProjectId } equals new { MaterialCode = stock.PipeLineMatCode, stock.WarehouseCode, stock .ProjectId} into st
|
||||
join stock in Funs.DB.Tw_MaterialStock on new { x.MaterialCode, master.WarehouseCode, master.ProjectId } equals new { MaterialCode = stock.PipeLineMatCode, stock.WarehouseCode, stock.ProjectId } into st
|
||||
from stock in st.DefaultIfEmpty()
|
||||
where
|
||||
(string.IsNullOrEmpty(table.Id) || x.Id.Contains(table.Id)) &&
|
||||
(string.IsNullOrEmpty(table.InOutPlanMasterId) || x.InOutPlanMasterId.Contains(table.InOutPlanMasterId)) &&
|
||||
(string.IsNullOrEmpty(table.PipelineComponentId) || x.PipelineComponentId.Contains(table.PipelineComponentId)) &&
|
||||
(string.IsNullOrEmpty(table.MaterialCode) || x.MaterialCode.Contains(table.MaterialCode))
|
||||
orderby x.SortIndex
|
||||
(string.IsNullOrEmpty(table.MaterialCode) || x.MaterialCode.Contains(table.MaterialCode))
|
||||
orderby x.SortIndex
|
||||
select new Model.Tw_InOutDetailOutput
|
||||
{
|
||||
Id = x.Id,
|
||||
@@ -48,9 +47,9 @@ namespace BLL
|
||||
ActNum = x.ActNum,
|
||||
PipelineComponentCode = y.PipelineComponentCode,
|
||||
MaterialName = mat.MaterialName,
|
||||
MaterialDef= mat.MaterialDef,
|
||||
MaterialDef = mat.MaterialDef,
|
||||
StockNum = stock.StockNum ?? 0,
|
||||
}
|
||||
}
|
||||
;
|
||||
|
||||
return q;
|
||||
@@ -73,7 +72,7 @@ namespace BLL
|
||||
q = q.Skip(grid1.PageSize * grid1.PageIndex).Take(grid1.PageSize);
|
||||
// q = SortConditionHelper.SortingAndPaging(q, Grid1.SortField, Grid1.SortDirection, Grid1.PageIndex, Grid1.PageSize);
|
||||
return from x in q
|
||||
select x;
|
||||
select x;
|
||||
}
|
||||
#endregion
|
||||
|
||||
@@ -100,7 +99,7 @@ namespace BLL
|
||||
Funs.DB.Tw_InOutPlanDetail.InsertOnSubmit(table);
|
||||
Funs.DB.SubmitChanges();
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 批量添加计划明细
|
||||
/// </summary>
|
||||
@@ -111,8 +110,8 @@ namespace BLL
|
||||
int sortIndex = 1;
|
||||
foreach (var item in list)
|
||||
{
|
||||
item.Id= SQLHelper.GetNewID();
|
||||
item.SortIndex= sortIndex;
|
||||
item.Id = SQLHelper.GetNewID();
|
||||
item.SortIndex = sortIndex;
|
||||
item.InOutPlanMasterId = inoutPlanMasterId;
|
||||
Add(item);
|
||||
sortIndex++;
|
||||
@@ -130,7 +129,7 @@ namespace BLL
|
||||
table.MaterialCode = newtable.MaterialCode;
|
||||
table.PlanNum = newtable.PlanNum;
|
||||
table.ActNum = newtable.ActNum;
|
||||
table.SortIndex= newtable.SortIndex;
|
||||
table.SortIndex = newtable.SortIndex;
|
||||
Funs.DB.SubmitChanges();
|
||||
}
|
||||
|
||||
@@ -146,7 +145,7 @@ namespace BLL
|
||||
}
|
||||
|
||||
}
|
||||
public static void DeleteByInOutPlanMasterId (string inoutPlanMasterId)
|
||||
public static void DeleteByInOutPlanMasterId(string inoutPlanMasterId)
|
||||
{
|
||||
var list = Funs.DB.Tw_InOutPlanDetail.Where(x => x.InOutPlanMasterId == inoutPlanMasterId);
|
||||
if (list != null)
|
||||
|
||||
@@ -1,16 +1,11 @@
|
||||
using EmitMapper;
|
||||
using FineUIPro;
|
||||
using Microsoft.Office.Interop.Word;
|
||||
using MiniExcelLibs;
|
||||
using Model;
|
||||
using NPOI.Util;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Numerics;
|
||||
using System.Text;
|
||||
using System.Web.UI.WebControls;
|
||||
|
||||
|
||||
namespace BLL
|
||||
@@ -33,7 +28,7 @@ namespace BLL
|
||||
var q = from x in Funs.DB.Tw_InOutPlanMaster
|
||||
join y in Funs.DB.HJGL_WeldTask on x.WeldTaskId equals y.WeldTaskId into yy
|
||||
from y in yy.DefaultIfEmpty()
|
||||
join person in Funs.DB.Person_Persons on x.CreateMan equals person.PersonId into persons
|
||||
join person in Funs.DB.Person_Persons on x.CreateMan equals person.PersonId into persons
|
||||
from person in persons.DefaultIfEmpty()
|
||||
join auditperson in Funs.DB.Person_Persons on x.AuditMan equals auditperson.PersonId into auditpersons
|
||||
from auditperson in auditpersons.DefaultIfEmpty()
|
||||
@@ -42,22 +37,22 @@ namespace BLL
|
||||
join warehouseperson in Funs.DB.Person_Persons on x.WarehouseMan equals warehouseperson.PersonId into warehousepersons
|
||||
from warehouseperson in warehousepersons.DefaultIfEmpty()
|
||||
join unit in Funs.DB.Base_Unit on x.ReqUnitId equals unit.UnitId into units
|
||||
from unit in units.DefaultIfEmpty()
|
||||
orderby x.CreateDate descending
|
||||
from unit in units.DefaultIfEmpty()
|
||||
orderby x.CreateDate descending
|
||||
where
|
||||
(string.IsNullOrEmpty(table.Id) || x.Id.Contains(table.Id)) &&
|
||||
(string.IsNullOrEmpty(table.ProjectId) || x.ProjectId.Contains(table.ProjectId)) &&
|
||||
(string.IsNullOrEmpty(table.CusBillCode) || x.CusBillCode.Contains(table.CusBillCode)) &&
|
||||
(string.IsNullOrEmpty(table.WarehouseCode) || x.WarehouseCode.Contains(table.WarehouseCode)) &&
|
||||
(string.IsNullOrEmpty(table.CreateMan) || x.CreateMan.Contains(table.CreateMan)) &&
|
||||
(string.IsNullOrEmpty(table.OutputMasterId) || x.OutputMasterId.Contains(table.OutputMasterId)) &&
|
||||
(string.IsNullOrEmpty(table.OutputMasterId) || x.OutputMasterId.Contains(table.OutputMasterId)) &&
|
||||
(string.IsNullOrEmpty(table.ReqUnitId) || x.ReqUnitId.Contains(table.ReqUnitId)) &&
|
||||
(string.IsNullOrEmpty(table.UnitWorkId) || x.WeldTaskId.Contains(table.UnitWorkId))&&
|
||||
(string.IsNullOrEmpty(table.WeldTaskId) || x.WeldTaskId.Contains(table.WeldTaskId))&&
|
||||
(string.IsNullOrEmpty(table.UnitWorkId) || x.WeldTaskId.Contains(table.UnitWorkId)) &&
|
||||
(string.IsNullOrEmpty(table.WeldTaskId) || x.WeldTaskId.Contains(table.WeldTaskId)) &&
|
||||
(table.InOutType == null || x.InOutType == table.InOutType) &&
|
||||
(table.TypeInt == null || x.TypeInt == table.TypeInt) &&
|
||||
(table.Category == null || x.Category == table.Category) &&
|
||||
(table.State == null || x.State == table.State)
|
||||
(table.State == null || x.State == table.State)
|
||||
select new Model.Tw_InOutMasterOutput
|
||||
{
|
||||
Id = x.Id,
|
||||
@@ -76,7 +71,7 @@ namespace BLL
|
||||
WeldTaskId = x.WeldTaskId,
|
||||
ReqUnitId = x.ReqUnitId,
|
||||
ReqUnitName = unit.UnitName,
|
||||
UnitWorkId = y.UnitWorkId,
|
||||
UnitWorkId = y.UnitWorkId,
|
||||
WeldTaskCode = y.TaskCode,
|
||||
AuditMan = x.AuditMan,
|
||||
AuditManName = auditperson.PersonName,
|
||||
@@ -87,8 +82,8 @@ namespace BLL
|
||||
AuditDate2 = x.AuditDate2,
|
||||
WarehouseMan = x.WarehouseMan,
|
||||
WarehouseDate = x.WarehouseDate,
|
||||
WarehouseManName= warehouseperson.PersonName,
|
||||
PipeLineSortIndex=y.PipeLineSortIndex
|
||||
WarehouseManName = warehouseperson.PersonName,
|
||||
PipeLineSortIndex = y.PipeLineSortIndex
|
||||
|
||||
}
|
||||
;
|
||||
@@ -115,41 +110,41 @@ namespace BLL
|
||||
var result = q.ToList();
|
||||
// q = SortConditionHelper.SortingAndPaging(q, Grid1.SortField, Grid1.SortDirection, Grid1.PageIndex, Grid1.PageSize);
|
||||
return (from x in result
|
||||
select new Model.Tw_InOutMasterOutput
|
||||
{
|
||||
Id = x.Id,
|
||||
ProjectId = x.ProjectId,
|
||||
CusBillCode = x.CusBillCode,
|
||||
WarehouseCode = x.WarehouseCode,
|
||||
Source = x.Source,
|
||||
InOutType = x.InOutType,
|
||||
TypeInt = x.TypeInt,
|
||||
Category = x.Category,
|
||||
State = x.State,
|
||||
CreateMan = x.CreateMan,
|
||||
CreateManName = x.CreateManName,
|
||||
CreateDate = x.CreateDate,
|
||||
OutputMasterId = x.OutputMasterId,
|
||||
WeldTaskId = x.WeldTaskId,
|
||||
ReqUnitId = x.ReqUnitId,
|
||||
ReqUnitName = x.ReqUnitName,
|
||||
UnitWorkId = x.UnitWorkId,
|
||||
WeldTaskCode = x.WeldTaskId != null ? x.WeldTaskId.Contains('|') ? Funs.DB.HJGL_WeldTask.FirstOrDefault(e => e.UnitWorkId == x.WeldTaskId.Split('|')[0].ToString() && e.UnitId == x.WeldTaskId.Split('|')[1].ToString() && e.TaskDate.Value.Date == DateTime.ParseExact(x.WeldTaskId.Split('|')[2].ToString(), "yyyyMMdd", null).Date)?.TaskCode : "" : "",
|
||||
CategoryString = TwConst.CategoryMap.FirstOrDefault(y => y.Value == x.Category).Key,
|
||||
TypeString = TwConst.TypeIntMap.FirstOrDefault(y => y.Value == x.TypeInt).Key,
|
||||
StateString = TwConst.StateMap.FirstOrDefault(y => y.Value == x.State).Key,
|
||||
AuditMan = x.AuditMan,
|
||||
AuditManName = x.AuditManName,
|
||||
AuditDate = x.AuditDate,
|
||||
Remark = x.Remark,
|
||||
AuditMan2=x.AuditMan2,
|
||||
AuditManName2 = x.AuditManName2,
|
||||
AuditDate2 = x.AuditDate2,
|
||||
WarehouseMan = x.WarehouseMan,
|
||||
WarehouseDate = x.WarehouseDate,
|
||||
WarehouseManName= x.WarehouseManName,
|
||||
PipeLineSortIndex = x.PipeLineSortIndex,
|
||||
}).ToList();
|
||||
select new Model.Tw_InOutMasterOutput
|
||||
{
|
||||
Id = x.Id,
|
||||
ProjectId = x.ProjectId,
|
||||
CusBillCode = x.CusBillCode,
|
||||
WarehouseCode = x.WarehouseCode,
|
||||
Source = x.Source,
|
||||
InOutType = x.InOutType,
|
||||
TypeInt = x.TypeInt,
|
||||
Category = x.Category,
|
||||
State = x.State,
|
||||
CreateMan = x.CreateMan,
|
||||
CreateManName = x.CreateManName,
|
||||
CreateDate = x.CreateDate,
|
||||
OutputMasterId = x.OutputMasterId,
|
||||
WeldTaskId = x.WeldTaskId,
|
||||
ReqUnitId = x.ReqUnitId,
|
||||
ReqUnitName = x.ReqUnitName,
|
||||
UnitWorkId = x.UnitWorkId,
|
||||
WeldTaskCode = x.WeldTaskId != null ? x.WeldTaskId.Contains('|') ? Funs.DB.HJGL_WeldTask.FirstOrDefault(e => e.UnitWorkId == x.WeldTaskId.Split('|')[0].ToString() && e.UnitId == x.WeldTaskId.Split('|')[1].ToString() && e.TaskDate.Value.Date == DateTime.ParseExact(x.WeldTaskId.Split('|')[2].ToString(), "yyyyMMdd", null).Date)?.TaskCode : "" : "",
|
||||
CategoryString = TwConst.CategoryMap.FirstOrDefault(y => y.Value == x.Category).Key,
|
||||
TypeString = TwConst.TypeIntMap.FirstOrDefault(y => y.Value == x.TypeInt).Key,
|
||||
StateString = TwConst.StateMap.FirstOrDefault(y => y.Value == x.State).Key,
|
||||
AuditMan = x.AuditMan,
|
||||
AuditManName = x.AuditManName,
|
||||
AuditDate = x.AuditDate,
|
||||
Remark = x.Remark,
|
||||
AuditMan2 = x.AuditMan2,
|
||||
AuditManName2 = x.AuditManName2,
|
||||
AuditDate2 = x.AuditDate2,
|
||||
WarehouseMan = x.WarehouseMan,
|
||||
WarehouseDate = x.WarehouseDate,
|
||||
WarehouseManName = x.WarehouseManName,
|
||||
PipeLineSortIndex = x.PipeLineSortIndex,
|
||||
}).ToList();
|
||||
}
|
||||
|
||||
public static IEnumerable GetListData(Model.Tw_InOutMasterOutput table, Grid grid1)
|
||||
@@ -194,38 +189,38 @@ namespace BLL
|
||||
Remark = x.Remark,
|
||||
AuditMan2 = x.AuditMan2,
|
||||
AuditManName2 = x.AuditManName2,
|
||||
AuditDate2 = x.AuditDate2,
|
||||
AuditDate2 = x.AuditDate2,
|
||||
WarehouseMan = x.WarehouseMan,
|
||||
WarehouseDate = x.WarehouseDate,
|
||||
WarehouseManName= x.WarehouseManName
|
||||
WarehouseDate = x.WarehouseDate,
|
||||
WarehouseManName = x.WarehouseManName
|
||||
};
|
||||
}
|
||||
|
||||
public static string GetWeldTaskCode( string WeldTaskId)
|
||||
public static string GetWeldTaskCode(string WeldTaskId)
|
||||
{
|
||||
string result=String.Empty;
|
||||
string result = String.Empty;
|
||||
|
||||
if (string.IsNullOrEmpty(WeldTaskId)) return result;
|
||||
|
||||
if (WeldTaskId.Split('|').Length==3) //用于处理历史数据
|
||||
{
|
||||
if (WeldTaskId.Split('|').Length == 3) //用于处理历史数据
|
||||
{
|
||||
result = (from x in Funs.DB.HJGL_WeldTask
|
||||
where x.UnitWorkId == WeldTaskId.Split('|')[0].ToString()
|
||||
&& x.UnitId == WeldTaskId.Split('|')[1].ToString()
|
||||
&& x.TaskDate.Value.Date ==
|
||||
DateTime.ParseExact(WeldTaskId.Split('|')[2].ToString(), "yyyyMMdd", null)
|
||||
select x.TaskCode).FirstOrDefault()
|
||||
where x.UnitWorkId == WeldTaskId.Split('|')[0].ToString()
|
||||
&& x.UnitId == WeldTaskId.Split('|')[1].ToString()
|
||||
&& x.TaskDate.Value.Date ==
|
||||
DateTime.ParseExact(WeldTaskId.Split('|')[2].ToString(), "yyyyMMdd", null)
|
||||
select x.TaskCode).FirstOrDefault()
|
||||
?.ToString();
|
||||
|
||||
}
|
||||
else if (WeldTaskId.Split('|').Length == 4)
|
||||
{
|
||||
result = (from x in Funs.DB.HJGL_WeldTask
|
||||
where x.UnitWorkId == WeldTaskId.Split('|')[0].ToString()
|
||||
&& x.UnitId == WeldTaskId.Split('|')[1].ToString()
|
||||
&& x.TaskDate.Value.Date ==
|
||||
DateTime.ParseExact(WeldTaskId.Split('|')[2].ToString(), "yyyyMMdd", null)
|
||||
&& x.SerialNumber== WeldTaskId.Split('|')[3]
|
||||
where x.UnitWorkId == WeldTaskId.Split('|')[0].ToString()
|
||||
&& x.UnitId == WeldTaskId.Split('|')[1].ToString()
|
||||
&& x.TaskDate.Value.Date ==
|
||||
DateTime.ParseExact(WeldTaskId.Split('|')[2].ToString(), "yyyyMMdd", null)
|
||||
&& x.SerialNumber == WeldTaskId.Split('|')[3]
|
||||
select x.TaskCode).FirstOrDefault()
|
||||
?.ToString();
|
||||
}
|
||||
@@ -243,7 +238,7 @@ namespace BLL
|
||||
/// <param name="projectid"></param>
|
||||
/// <param name="creatUserId"></param>
|
||||
/// <returns></returns>
|
||||
public static ResponeData ImportData(string OriFileName,string path, string projectid, string creatUserId)
|
||||
public static ResponeData ImportData(string OriFileName, string path, string projectid, string creatUserId)
|
||||
{
|
||||
var responeData = new ResponeData();
|
||||
List<Tw_InputDataIn> temeplateDtoIns;
|
||||
@@ -269,9 +264,9 @@ namespace BLL
|
||||
string errorWarehouseCode = "";
|
||||
foreach (var item in warehouseCodeList)
|
||||
{
|
||||
if (!DropListService.HJGL_WarehouseCode().Select(x=>x.Value== item).Any())
|
||||
if (!DropListService.HJGL_WarehouseCode().Select(x => x.Value == item).Any())
|
||||
{
|
||||
errorWarehouseCode+=item+",";
|
||||
errorWarehouseCode += item + ",";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -280,15 +275,15 @@ namespace BLL
|
||||
if (temeplateDtoIns.Count == 0)
|
||||
{
|
||||
responeData.code = 0;
|
||||
responeData.message = errorWarehouseCode+"仓库不存在!";
|
||||
responeData.message = errorWarehouseCode + "仓库不存在!";
|
||||
return responeData;
|
||||
}
|
||||
}
|
||||
var typeString = temeplateDtoIns.Select(x => x.TypeString).Distinct().ToList(); //获取导入文件的类型
|
||||
if (typeString.Where(x=>string.IsNullOrEmpty(x)).Count()>0)
|
||||
if (typeString.Where(x => string.IsNullOrEmpty(x)).Count() > 0)
|
||||
{
|
||||
responeData.code = 0;
|
||||
responeData.message ="导入数据中类型列不能为空!";
|
||||
responeData.message = "导入数据中类型列不能为空!";
|
||||
return responeData;
|
||||
}
|
||||
if (typeString.Contains("采购入库") && typeString.Contains("其他入库"))
|
||||
@@ -300,10 +295,10 @@ namespace BLL
|
||||
|
||||
|
||||
var materialCodeList = temeplateDtoIns.Select(x => x.MaterialCode).Distinct().ToList(); //获取导入文件的材料编码
|
||||
var IsExitMaterialCode=
|
||||
from x in Funs.DB.HJGL_MaterialCodeLib
|
||||
where materialCodeList.Contains(x.MaterialCode)
|
||||
select x.MaterialCode;
|
||||
var IsExitMaterialCode =
|
||||
from x in Funs.DB.HJGL_MaterialCodeLib
|
||||
where materialCodeList.Contains(x.MaterialCode)
|
||||
select x.MaterialCode;
|
||||
if (IsExitMaterialCode.Count() < materialCodeList.Count)
|
||||
{
|
||||
var errorMaterialCode = materialCodeList.Except(IsExitMaterialCode.ToList());
|
||||
@@ -314,7 +309,7 @@ namespace BLL
|
||||
return responeData;
|
||||
}
|
||||
}
|
||||
string cusbilcode = GetDataInCusBillCode(projectid,UnitService.GetUnitCodeByUnitId(Person_PersonsService.GetPerson_PersonsById(creatUserId).UnitId), temeplateDtoIns.FirstOrDefault().TypeString);
|
||||
string cusbilcode = GetDataInCusBillCode(projectid, UnitService.GetUnitCodeByUnitId(Person_PersonsService.GetPerson_PersonsById(creatUserId).UnitId), temeplateDtoIns.FirstOrDefault().TypeString);
|
||||
foreach (var item in temeplateDtoIns)
|
||||
{
|
||||
item.CusBillCode = cusbilcode;
|
||||
@@ -348,7 +343,7 @@ namespace BLL
|
||||
var twInOutPlanDetails = mapperDetail.Map(CusBillCodeDtoIns.Where(x => !string.IsNullOrEmpty(x.MaterialCode) && !string.IsNullOrEmpty(x.PlanNum)).ToList());
|
||||
|
||||
twInOutPlanMaster.Id = SQLHelper.GetNewID();
|
||||
twInOutPlanMaster.InOutType= (int)TwConst.InOutType.入库;
|
||||
twInOutPlanMaster.InOutType = (int)TwConst.InOutType.入库;
|
||||
twInOutPlanMaster.State = (int)TwConst.State.待审核;
|
||||
|
||||
if ("采购入库".Equals(FirstCusBillCodeDtoIns.TypeString))
|
||||
@@ -365,12 +360,12 @@ namespace BLL
|
||||
twInOutPlanMaster.TypeInt = (int)TwConst.TypeInt.其他入库;
|
||||
}
|
||||
|
||||
twInOutPlanMaster.Category= (int)TwConst.Category.全部;
|
||||
twInOutPlanMaster.Category = (int)TwConst.Category.全部;
|
||||
twInOutPlanMaster.ProjectId = projectid;
|
||||
twInOutPlanMaster.CreateMan = creatUserId;
|
||||
twInOutPlanMaster.CreateDate = DateTime.Now;
|
||||
twInOutPlanMaster.Remark = OriFileName;
|
||||
Add(twInOutPlanMaster);
|
||||
Add(twInOutPlanMaster);
|
||||
TwInOutplandetailService.AddList(twInOutPlanDetails, twInOutPlanMaster.Id); //插入入库明细
|
||||
|
||||
}
|
||||
@@ -404,8 +399,8 @@ namespace BLL
|
||||
AuditMan = newtable.AuditMan,
|
||||
AuditDate = newtable.AuditDate,
|
||||
Remark = newtable.Remark,
|
||||
AuditMan2=newtable.AuditMan2,
|
||||
AuditDate2=newtable.AuditDate2,
|
||||
AuditMan2 = newtable.AuditMan2,
|
||||
AuditDate2 = newtable.AuditDate2,
|
||||
WarehouseMan = newtable.WarehouseMan,
|
||||
WarehouseDate = newtable.WarehouseDate,
|
||||
};
|
||||
@@ -464,16 +459,16 @@ namespace BLL
|
||||
/// <param name="outputMasterId"></param>
|
||||
/// <param name="typeInt"></param>
|
||||
/// <returns></returns>
|
||||
public static string GenPlanMasterByOutputMasterId(string outputMasterId,TwConst.TypeInt typeInt)
|
||||
public static string GenPlanMasterByOutputMasterId(string outputMasterId, TwConst.TypeInt typeInt)
|
||||
{
|
||||
string message = "";
|
||||
|
||||
#region 数据校验
|
||||
|
||||
|
||||
//获取出库单
|
||||
var outMasterQuery = new Tw_InOutMasterOutput();
|
||||
outMasterQuery.Id = outputMasterId;
|
||||
var outMaster = TwOutputmasterService.GetListData(outMasterQuery) .FirstOrDefault() ;
|
||||
var outMaster = TwOutputmasterService.GetListData(outMasterQuery).FirstOrDefault();
|
||||
if (outMaster == null || outMaster.State != (int)TwConst.State.已完成)
|
||||
{
|
||||
message = "出库单状态错误,无法生成计划单!";
|
||||
@@ -482,7 +477,7 @@ namespace BLL
|
||||
//判断是否已经生成过计划单
|
||||
var queryIsExitInMaster = new Tw_InOutMasterOutput();
|
||||
queryIsExitInMaster.OutputMasterId = outMaster.Id;
|
||||
queryIsExitInMaster.TypeInt= (int)typeInt;
|
||||
queryIsExitInMaster.TypeInt = (int)typeInt;
|
||||
var IsExitInMaster = GetModle(queryIsExitInMaster).FirstOrDefault();
|
||||
if (IsExitInMaster != null)
|
||||
{
|
||||
@@ -497,11 +492,11 @@ namespace BLL
|
||||
{
|
||||
case TwConst.TypeInt.补料出库:
|
||||
details = details.Where(x => x.PlanNum > x.ActNum).ToList();
|
||||
foreach (var item in details)
|
||||
foreach (var item in details)
|
||||
{
|
||||
item.PlanNum = (item.PlanNum - item.ActNum);
|
||||
}
|
||||
if (details.Count==0)
|
||||
if (details.Count == 0)
|
||||
{
|
||||
message = "该出库单无需补料";
|
||||
return message;
|
||||
@@ -519,14 +514,14 @@ namespace BLL
|
||||
return message;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
//生成计划单
|
||||
var planMasterModel = new Model.Tw_InOutMasterOutput()
|
||||
{
|
||||
Id = Guid.NewGuid().ToString(),
|
||||
OutputMasterId = outMaster.Id,
|
||||
ProjectId = outMaster.ProjectId,
|
||||
ProjectId = outMaster.ProjectId,
|
||||
WarehouseCode = outMaster.WarehouseCode,
|
||||
Source = 2,
|
||||
Category = outMaster.Category,
|
||||
@@ -541,26 +536,26 @@ namespace BLL
|
||||
switch (typeInt)
|
||||
{
|
||||
case TwConst.TypeInt.补料出库:
|
||||
planMasterModel.CusBillCode = GetCusBillCodeByTaskCode(outMaster.WeldTaskCode,TwConst.TypeInt.补料出库,(BLL.TwConst.Category)planMasterModel.Category);
|
||||
planMasterModel.TypeInt= (int)TwConst.TypeInt.补料出库;
|
||||
planMasterModel.InOutType= (int)TwConst.InOutType.出库;
|
||||
planMasterModel.CusBillCode = GetCusBillCodeByTaskCode(outMaster.WeldTaskCode, TwConst.TypeInt.补料出库, (BLL.TwConst.Category)planMasterModel.Category);
|
||||
planMasterModel.TypeInt = (int)TwConst.TypeInt.补料出库;
|
||||
planMasterModel.InOutType = (int)TwConst.InOutType.出库;
|
||||
break;
|
||||
case TwConst.TypeInt.退料入库:
|
||||
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);
|
||||
pre += "-" + UnitWorkService.getUnitWorkByUnitWorkId(outMaster.UnitWorkId)?.UnitWorkCode;
|
||||
planMasterModel.CusBillCode = GetCusBillCodeByTaskCode(pre, TwConst.TypeInt.退料入库, (BLL.TwConst.Category)planMasterModel.Category);
|
||||
planMasterModel.TypeInt = (int)TwConst.TypeInt.退料入库;
|
||||
planMasterModel.InOutType = (int)TwConst.InOutType.入库;
|
||||
;
|
||||
;
|
||||
break;
|
||||
}
|
||||
Add(planMasterModel);
|
||||
//生成明细
|
||||
TwInOutplandetailService.AddList(details, planMasterModel.Id);
|
||||
return message;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 获取出库申请单编号
|
||||
/// </summary>
|
||||
@@ -568,17 +563,17 @@ namespace BLL
|
||||
/// <param name="typeInt"></param>
|
||||
/// <param name="category"></param>
|
||||
/// <returns></returns>
|
||||
public static string GetCusBillCodeByTaskCode(string taskCode,TwConst.TypeInt typeInt,TwConst.Category category )
|
||||
public static string GetCusBillCodeByTaskCode(string taskCode, TwConst.TypeInt typeInt, TwConst.Category category)
|
||||
{
|
||||
string cusBillCode = "";
|
||||
switch (typeInt )
|
||||
switch (typeInt)
|
||||
{
|
||||
case TwConst.TypeInt.领料出库:
|
||||
if (category== TwConst.Category.管段)
|
||||
if (category == TwConst.Category.管段)
|
||||
{
|
||||
cusBillCode = taskCode + "-AP-P01";
|
||||
}
|
||||
else if (category == TwConst.Category.管件)
|
||||
else if (category == TwConst.Category.管件)
|
||||
{
|
||||
cusBillCode = taskCode + "-AP-PF01";
|
||||
}
|
||||
@@ -611,12 +606,12 @@ namespace BLL
|
||||
}
|
||||
|
||||
|
||||
public static string GetDataInCusBillCode(string projectid, string unitcode,string typeString,string unitWorkCode="",string Category = "")
|
||||
public static string GetDataInCusBillCode(string projectid, string unitcode, string typeString, string unitWorkCode = "", string Category = "")
|
||||
{
|
||||
if (typeString == TwConst.TypeInt.其他入库.ToString())
|
||||
{
|
||||
//生成规则是20240919-unitcode-AP-GR01
|
||||
string cusBillCode = string.Format("{0:yyyyMMdd}", DateTime.Now) ;
|
||||
string cusBillCode = string.Format("{0:yyyyMMdd}", DateTime.Now);
|
||||
var queryAll = new Tw_InOutMasterOutput()
|
||||
{
|
||||
ProjectId = projectid,
|
||||
@@ -629,14 +624,14 @@ namespace BLL
|
||||
else if (typeString == TwConst.TypeInt.散件出库.ToString())
|
||||
{
|
||||
//生成规则是20240919-unitcode-AP-GR01
|
||||
string cusBillCode = string.Format("{0:yyyyMMdd}", DateTime.Now) + unitcode+"-" + unitWorkCode +"-";
|
||||
string cusBillCode = string.Format("{0:yyyyMMdd}", DateTime.Now) + unitcode + "-" + unitWorkCode + "-";
|
||||
var queryAll = new Tw_InOutMasterOutput()
|
||||
{
|
||||
ProjectId = projectid,
|
||||
CusBillCode = cusBillCode,
|
||||
Category = Category == TwConst.Category.管段.ToString() ? (int)TwConst.Category.管段 : (int)TwConst.Category.管件
|
||||
|
||||
};
|
||||
};
|
||||
var queryAllresult = GetModle(queryAll).Count();
|
||||
if (Category == TwConst.Category.管段.ToString())
|
||||
{
|
||||
@@ -660,7 +655,7 @@ namespace BLL
|
||||
TypeInt = (int)TwConst.TypeInt.其他出库,
|
||||
};
|
||||
var queryAllresult = GetModle(queryAll).Count();
|
||||
cusBillCode = cusBillCode +"-AP-"+ (queryAllresult + 1).ToString().PadLeft(2, '0');
|
||||
cusBillCode = cusBillCode + "-AP-" + (queryAllresult + 1).ToString().PadLeft(2, '0');
|
||||
return cusBillCode;
|
||||
}
|
||||
|
||||
@@ -686,38 +681,38 @@ namespace BLL
|
||||
/// <param name="unitid"></param>
|
||||
/// <param name="date"></param>
|
||||
/// <param name="Personid"></param>
|
||||
public static void GenOutPlanmasterByWeldTaskId(string unitworkid,string unitid,DateTime date,string serialNumber, string Personid)
|
||||
public static void GenOutPlanmasterByWeldTaskId(string unitworkid, string unitid, DateTime date, string serialNumber, string Personid)
|
||||
{
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
Model.View_HJGL_WeldingTask weldTask = db.View_HJGL_WeldingTask.FirstOrDefault(e => e.UnitWorkId==unitworkid && e.UnitId==unitid&& e.TaskDate.Value.Date==date.Date && e.SerialNumber==serialNumber);
|
||||
if (weldTask==null)
|
||||
Model.View_HJGL_WeldingTask weldTask = db.View_HJGL_WeldingTask.FirstOrDefault(e => e.UnitWorkId == unitworkid && e.UnitId == unitid && e.TaskDate.Value.Date == date.Date && e.SerialNumber == serialNumber);
|
||||
if (weldTask == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
string WeldTaskId= unitworkid+"|"+unitid+ "|" + string.Format("{0:yyyyMMdd}", date)+"|"+serialNumber;
|
||||
string WeldTaskId = unitworkid + "|" + unitid + "|" + string.Format("{0:yyyyMMdd}", date) + "|" + serialNumber;
|
||||
//判断是否已经生成过出库计划单
|
||||
var queryIsExitInMaster = new Tw_InOutMasterOutput();
|
||||
queryIsExitInMaster.WeldTaskId = WeldTaskId;
|
||||
queryIsExitInMaster.InOutType=(int)TwConst.InOutType.出库;
|
||||
queryIsExitInMaster.InOutType = (int)TwConst.InOutType.出库;
|
||||
queryIsExitInMaster.TypeInt = (int)TwConst.TypeInt.领料出库;
|
||||
var IsExitInMaster = TwInOutplanmasterService.GetModle(queryIsExitInMaster).FirstOrDefault();
|
||||
if (IsExitInMaster != null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
var pipelineList = db.View_HJGL_WeldingTask.Where(e => e.UnitWorkId == unitworkid && e.UnitId == unitid && e.TaskDate.Value.Date == date.Date && e.SerialNumber == serialNumber).OrderBy(x=>x.PipeLineSortIndex).Select(x=>x.PipelineId).Distinct().ToList();
|
||||
}
|
||||
var pipelineList = db.View_HJGL_WeldingTask.Where(e => e.UnitWorkId == unitworkid && e.UnitId == unitid && e.TaskDate.Value.Date == date.Date && e.SerialNumber == serialNumber).OrderBy(x => x.PipeLineSortIndex).Select(x => x.PipelineId).Distinct().ToList();
|
||||
//领料出库需要排除散件材料
|
||||
var MaterDatial= from x in db.HJGL_PipeLineMat
|
||||
join y in db.HJGL_MaterialCodeLib on x.MaterialCode equals y.MaterialCode
|
||||
where pipelineList.Contains(x.PipelineId) && x.PrefabricatedComponents !=null
|
||||
select new
|
||||
{
|
||||
x.PipelineId,
|
||||
x.PrefabricatedComponents,
|
||||
x.MaterialCode,
|
||||
x.Number,
|
||||
y.MaterialUnit,
|
||||
};
|
||||
var MaterDatial = from x in db.HJGL_PipeLineMat
|
||||
join y in db.HJGL_MaterialCodeLib on x.MaterialCode equals y.MaterialCode
|
||||
where pipelineList.Contains(x.PipelineId) && x.PrefabricatedComponents != null
|
||||
select new
|
||||
{
|
||||
x.PipelineId,
|
||||
x.PrefabricatedComponents,
|
||||
x.MaterialCode,
|
||||
x.Number,
|
||||
y.MaterialUnit,
|
||||
};
|
||||
//var outMateriaList = from x in db.HJGL_PipeLineMat
|
||||
// join y in db.HJGL_MaterialCodeLib on x.MaterialCode equals y.MaterialCode
|
||||
// where pipelineList.Contains(x.PipelineId)
|
||||
@@ -729,7 +724,7 @@ namespace BLL
|
||||
// planNum = g.Sum(x => x.Number) ?? 0,
|
||||
// MaterialName = g.Key.MaterialUnit,
|
||||
// };
|
||||
var outMateriaList = from x in MaterDatial
|
||||
var outMateriaList = from x in MaterDatial
|
||||
group x by new { x.MaterialCode, x.MaterialUnit }
|
||||
into g
|
||||
select new
|
||||
@@ -749,7 +744,7 @@ namespace BLL
|
||||
Id = Guid.NewGuid().ToString(),
|
||||
ProjectId = weldTask.ProjectId,
|
||||
// CusBillCode = string.Format("{0:yyyyMMdd}", DateTime.Now) + UnitService.GetUnitCodeByUnitId(weldTask.UnitId) + "-" + UnitWorkService.getUnitWorkByUnitWorkId(weldTask.UnitWorkId)?.UnitWorkCode + "AP-PF01",
|
||||
CusBillCode=TwInOutplanmasterService.GetCusBillCodeByTaskCode(weldTaskCode,TwConst.TypeInt.领料出库,TwConst.Category.管件),
|
||||
CusBillCode = TwInOutplanmasterService.GetCusBillCodeByTaskCode(weldTaskCode, TwConst.TypeInt.领料出库, TwConst.Category.管件),
|
||||
WarehouseCode = PipelineService.GetPipeArea().Where(x => x.Value == PipelineService.GetPipelineByPipelineId(weldTask.PipelineId).PipeArea).Select(x => x.Text).FirstOrDefault(),
|
||||
Source = 1,
|
||||
InOutType = (int)TwConst.InOutType.出库,
|
||||
@@ -774,7 +769,7 @@ namespace BLL
|
||||
TwInOutplandetailService.Add(detail);
|
||||
}
|
||||
var twinoutplandetailRelationList = MaterDatial.ToList().Select(x => new Tw_InOutPlanDetail_Relation
|
||||
{
|
||||
{
|
||||
PipelineId = x.PipelineId,
|
||||
MaterialCode = x.MaterialCode,
|
||||
Number = x.Number,
|
||||
@@ -788,7 +783,7 @@ namespace BLL
|
||||
{
|
||||
Id = Guid.NewGuid().ToString(),
|
||||
ProjectId = weldTask.ProjectId,
|
||||
CusBillCode =TwInOutplanmasterService.GetCusBillCodeByTaskCode(weldTaskCode, TwConst.TypeInt.领料出库, TwConst.Category.管段),
|
||||
CusBillCode = TwInOutplanmasterService.GetCusBillCodeByTaskCode(weldTaskCode, TwConst.TypeInt.领料出库, TwConst.Category.管段),
|
||||
WarehouseCode = PipelineService.GetPipeArea().Where(x => x.Value == PipelineService.GetPipelineByPipelineId(weldTask.PipelineId).PipeArea).Select(x => x.Text).FirstOrDefault(),
|
||||
Source = 1,
|
||||
InOutType = (int)TwConst.InOutType.出库,
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
using FineUIPro;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
|
||||
namespace BLL
|
||||
@@ -35,7 +33,7 @@ namespace BLL
|
||||
(string.IsNullOrEmpty(table.InputMasterId) || x.InputMasterId.Contains(table.InputMasterId)) &&
|
||||
(string.IsNullOrEmpty(table.PipelineComponentId) || x.PipelineComponentId.Contains(table.PipelineComponentId)) &&
|
||||
(string.IsNullOrEmpty(table.MaterialCode) || x.MaterialCode.Contains(table.MaterialCode))
|
||||
orderby x.SortIndex
|
||||
orderby x.SortIndex
|
||||
select new Model.Tw_InOutDetailOutput
|
||||
{
|
||||
Id = x.Id,
|
||||
@@ -128,20 +126,20 @@ namespace BLL
|
||||
public static IEnumerable GePrintListByInputMasterIds(List<string> inputMasterIds)
|
||||
{
|
||||
var q = from x in Funs.DB.Tw_InputDetail
|
||||
join mat in Funs.DB.HJGL_MaterialCodeLib on x.MaterialCode equals mat.MaterialCode into mm
|
||||
from mat in mm.DefaultIfEmpty()
|
||||
join y in Funs.DB.Tw_InputMaster on x.InputMasterId equals y.Id
|
||||
where inputMasterIds.Contains(x.InputMasterId)
|
||||
orderby y.CusBillCode,x.SortIndex
|
||||
select new
|
||||
{
|
||||
入库单编号 = y.CusBillCode,
|
||||
材料编码 = x.MaterialCode,
|
||||
材料名称 = mat.MaterialName,
|
||||
材料描述 = mat.MaterialDef,
|
||||
计划数量 = x.PlanNum,
|
||||
实际数量 = x.ActNum,
|
||||
};
|
||||
join mat in Funs.DB.HJGL_MaterialCodeLib on x.MaterialCode equals mat.MaterialCode into mm
|
||||
from mat in mm.DefaultIfEmpty()
|
||||
join y in Funs.DB.Tw_InputMaster on x.InputMasterId equals y.Id
|
||||
where inputMasterIds.Contains(x.InputMasterId)
|
||||
orderby y.CusBillCode, x.SortIndex
|
||||
select new
|
||||
{
|
||||
入库单编号 = y.CusBillCode,
|
||||
材料编码 = x.MaterialCode,
|
||||
材料名称 = mat.MaterialName,
|
||||
材料描述 = mat.MaterialDef,
|
||||
计划数量 = x.PlanNum,
|
||||
实际数量 = x.ActNum,
|
||||
};
|
||||
return q;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,14 +4,13 @@ using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
|
||||
namespace BLL
|
||||
{
|
||||
|
||||
public static class TwInputmasterService
|
||||
{
|
||||
{
|
||||
#region 获取列表
|
||||
/// <summary>
|
||||
/// 记录数
|
||||
@@ -39,8 +38,8 @@ namespace BLL
|
||||
(string.IsNullOrEmpty(table.CusBillCode) || x.CusBillCode.Contains(table.CusBillCode)) &&
|
||||
(string.IsNullOrEmpty(table.WarehouseCode) || x.WarehouseCode.Contains(table.WarehouseCode)) &&
|
||||
(string.IsNullOrEmpty(table.CreateMan) || x.CreateMan.Contains(table.CreateMan)) &&
|
||||
(string.IsNullOrEmpty(table.ReqUnitId) || x.ReqUnitId.Contains(table.ReqUnitId)) &&
|
||||
(table.TypeInt == null || x.TypeInt == table.TypeInt) &&
|
||||
(string.IsNullOrEmpty(table.ReqUnitId) || x.ReqUnitId.Contains(table.ReqUnitId)) &&
|
||||
(table.TypeInt == null || x.TypeInt == table.TypeInt) &&
|
||||
(table.Category == null || x.Category == table.Category) &&
|
||||
(table.State == null || x.State == table.State)
|
||||
select new Model.Tw_InOutMasterOutput
|
||||
@@ -88,36 +87,36 @@ namespace BLL
|
||||
var result = q.Skip(grid1.PageSize * grid1.PageIndex).Take(grid1.PageSize).ToList();
|
||||
// q = SortConditionHelper.SortingAndPaging(q, Grid1.SortField, Grid1.SortDirection, Grid1.PageIndex, Grid1.PageSize);
|
||||
return from x in result
|
||||
select new Model.Tw_InOutMasterOutput
|
||||
{
|
||||
Id = x.Id,
|
||||
ProjectId = x.ProjectId,
|
||||
CusBillCode = x.CusBillCode,
|
||||
InOutPlanMasterId = x.InOutPlanMasterId,
|
||||
WarehouseCode = x.WarehouseCode,
|
||||
Source = x.Source,
|
||||
TypeInt = x.TypeInt,
|
||||
State = x.State,
|
||||
CreateMan = x.CreateMan,
|
||||
CreateManName = x.CreateManName,
|
||||
CreateDate = x.CreateDate,
|
||||
ReqUnitId = x.ReqUnitId,
|
||||
ReqUnitName = x.ReqUnitName,
|
||||
Category = x.Category,
|
||||
CategoryString = TwConst.CategoryMap.FirstOrDefault(y => y.Value == x.Category).Key,
|
||||
TypeString = TwConst.TypeIntMap.FirstOrDefault(y => y.Value == x.TypeInt).Key,
|
||||
StateString = TwConst.StateMap.FirstOrDefault(y => y.Value == x.State).Key,
|
||||
AuditMan = x.AuditMan,
|
||||
AuditManName = x.AuditManName,
|
||||
AuditDate = x.AuditDate,
|
||||
Remark=x.Remark,
|
||||
WarehouseMan = x.WarehouseMan,
|
||||
WarehouseDate = x.WarehouseDate,
|
||||
WarehouseManName= x.WarehouseManName
|
||||
};
|
||||
select new Model.Tw_InOutMasterOutput
|
||||
{
|
||||
Id = x.Id,
|
||||
ProjectId = x.ProjectId,
|
||||
CusBillCode = x.CusBillCode,
|
||||
InOutPlanMasterId = x.InOutPlanMasterId,
|
||||
WarehouseCode = x.WarehouseCode,
|
||||
Source = x.Source,
|
||||
TypeInt = x.TypeInt,
|
||||
State = x.State,
|
||||
CreateMan = x.CreateMan,
|
||||
CreateManName = x.CreateManName,
|
||||
CreateDate = x.CreateDate,
|
||||
ReqUnitId = x.ReqUnitId,
|
||||
ReqUnitName = x.ReqUnitName,
|
||||
Category = x.Category,
|
||||
CategoryString = TwConst.CategoryMap.FirstOrDefault(y => y.Value == x.Category).Key,
|
||||
TypeString = TwConst.TypeIntMap.FirstOrDefault(y => y.Value == x.TypeInt).Key,
|
||||
StateString = TwConst.StateMap.FirstOrDefault(y => y.Value == x.State).Key,
|
||||
AuditMan = x.AuditMan,
|
||||
AuditManName = x.AuditManName,
|
||||
AuditDate = x.AuditDate,
|
||||
Remark = x.Remark,
|
||||
WarehouseMan = x.WarehouseMan,
|
||||
WarehouseDate = x.WarehouseDate,
|
||||
WarehouseManName = x.WarehouseManName
|
||||
};
|
||||
}
|
||||
|
||||
public static List<Tw_InOutMasterOutput> GetListData(Model.Tw_InOutMasterOutput table )
|
||||
public static List<Tw_InOutMasterOutput> GetListData(Model.Tw_InOutMasterOutput table)
|
||||
{
|
||||
var q = GetModle(table);
|
||||
Count = q.Count();
|
||||
@@ -128,33 +127,33 @@ namespace BLL
|
||||
var result = q.ToList();
|
||||
// q = SortConditionHelper.SortingAndPaging(q, Grid1.SortField, Grid1.SortDirection, Grid1.PageIndex, Grid1.PageSize);
|
||||
return (from x in result
|
||||
select new Model.Tw_InOutMasterOutput
|
||||
{
|
||||
Id = x.Id,
|
||||
ProjectId = x.ProjectId,
|
||||
CusBillCode = x.CusBillCode,
|
||||
InOutPlanMasterId = x.InOutPlanMasterId,
|
||||
WarehouseCode = x.WarehouseCode,
|
||||
Source = x.Source,
|
||||
TypeInt = x.TypeInt,
|
||||
State = x.State,
|
||||
CreateMan = x.CreateMan,
|
||||
CreateManName = x.CreateManName,
|
||||
CreateDate = x.CreateDate,
|
||||
ReqUnitId = x.ReqUnitId,
|
||||
ReqUnitName = x.ReqUnitName,
|
||||
Category = x.Category,
|
||||
CategoryString = TwConst.CategoryMap.FirstOrDefault(y => y.Value == x.Category).Key,
|
||||
TypeString = TwConst.TypeIntMap.FirstOrDefault(y => y.Value == x.TypeInt).Key,
|
||||
StateString = TwConst.StateMap.FirstOrDefault(y => y.Value == x.State).Key,
|
||||
AuditMan = x.AuditMan,
|
||||
AuditManName = x.AuditManName,
|
||||
AuditDate = x.AuditDate,
|
||||
Remark = x.Remark,
|
||||
WarehouseMan = x.WarehouseMan,
|
||||
WarehouseDate = x.WarehouseDate,
|
||||
WarehouseManName= x.WarehouseManName
|
||||
}).ToList();
|
||||
select new Model.Tw_InOutMasterOutput
|
||||
{
|
||||
Id = x.Id,
|
||||
ProjectId = x.ProjectId,
|
||||
CusBillCode = x.CusBillCode,
|
||||
InOutPlanMasterId = x.InOutPlanMasterId,
|
||||
WarehouseCode = x.WarehouseCode,
|
||||
Source = x.Source,
|
||||
TypeInt = x.TypeInt,
|
||||
State = x.State,
|
||||
CreateMan = x.CreateMan,
|
||||
CreateManName = x.CreateManName,
|
||||
CreateDate = x.CreateDate,
|
||||
ReqUnitId = x.ReqUnitId,
|
||||
ReqUnitName = x.ReqUnitName,
|
||||
Category = x.Category,
|
||||
CategoryString = TwConst.CategoryMap.FirstOrDefault(y => y.Value == x.Category).Key,
|
||||
TypeString = TwConst.TypeIntMap.FirstOrDefault(y => y.Value == x.TypeInt).Key,
|
||||
StateString = TwConst.StateMap.FirstOrDefault(y => y.Value == x.State).Key,
|
||||
AuditMan = x.AuditMan,
|
||||
AuditManName = x.AuditManName,
|
||||
AuditDate = x.AuditDate,
|
||||
Remark = x.Remark,
|
||||
WarehouseMan = x.WarehouseMan,
|
||||
WarehouseDate = x.WarehouseDate,
|
||||
WarehouseManName = x.WarehouseManName
|
||||
}).ToList();
|
||||
}
|
||||
#endregion
|
||||
|
||||
@@ -181,16 +180,16 @@ namespace BLL
|
||||
CreateMan = newtable.CreateMan,
|
||||
CreateDate = newtable.CreateDate,
|
||||
ReqUnitId = newtable.ReqUnitId,
|
||||
AuditMan= newtable.AuditMan,
|
||||
AuditMan = newtable.AuditMan,
|
||||
AuditDate = newtable.AuditDate,
|
||||
Remark = newtable.Remark,
|
||||
WarehouseMan= newtable.WarehouseMan,
|
||||
WarehouseMan = newtable.WarehouseMan,
|
||||
WarehouseDate = newtable.WarehouseDate
|
||||
};
|
||||
Funs.DB.Tw_InputMaster.InsertOnSubmit(table);
|
||||
Funs.DB.SubmitChanges();
|
||||
}
|
||||
|
||||
|
||||
public static void Update(Model.Tw_InputMaster newtable)
|
||||
{
|
||||
|
||||
@@ -233,16 +232,16 @@ namespace BLL
|
||||
/// <summary>
|
||||
/// 根据计划单生成入库单
|
||||
/// </summary>
|
||||
public static void GenInMasterByPlanId(string planId, List<Model.Tw_InputDetail> detailLists,string remark)
|
||||
public static void GenInMasterByPlanId(string planId, List<Model.Tw_InputDetail> detailLists, string remark)
|
||||
{
|
||||
//获取计划单
|
||||
var planQueryModel = new Tw_InOutMasterOutput();
|
||||
planQueryModel.Id = planId;
|
||||
var plan = TwInOutplanmasterService.GetListData(planQueryModel).FirstOrDefault();
|
||||
if (plan == null || plan.State!= (int)TwConst.State.已审核)
|
||||
var plan = TwInOutplanmasterService.GetListData(planQueryModel).FirstOrDefault();
|
||||
if (plan == null || plan.State != (int)TwConst.State.已审核)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
//判断是否已经生成过入库单
|
||||
var queryIsExitInMaster = new Tw_InOutMasterOutput();
|
||||
queryIsExitInMaster.InOutPlanMasterId = planId;
|
||||
@@ -269,7 +268,7 @@ namespace BLL
|
||||
ReqUnitId = plan.ReqUnitId,
|
||||
AuditMan = plan.AuditMan,
|
||||
AuditDate = plan.AuditDate,
|
||||
Remark= remark,
|
||||
Remark = remark,
|
||||
WarehouseMan = plan.WarehouseMan,
|
||||
WarehouseDate = plan.WarehouseDate
|
||||
};
|
||||
@@ -292,20 +291,20 @@ namespace BLL
|
||||
TwMaterialstockService.UpdateStockNum(master.ProjectId, detail.MaterialCode, master.WarehouseCode, TwConst.InOutType.入库, detailTable.ActNum);
|
||||
|
||||
}
|
||||
var planTable =TwInOutplanmasterService.GetById(plan.Id);
|
||||
var planTable = TwInOutplanmasterService.GetById(plan.Id);
|
||||
if (planTable != null)
|
||||
{
|
||||
planTable.State = (int)TwConst.State.已完成;
|
||||
TwInOutplanmasterService.Update(planTable);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
/// <summary>
|
||||
/// 根据计划单撤销入库单
|
||||
/// </summary>
|
||||
/// <param name="planId"></param>
|
||||
public static void RevokeGenInMasterByPlanId(string planId)
|
||||
{
|
||||
{
|
||||
//校验计划单状态
|
||||
var plan = TwInOutplanmasterService.GetById(planId);
|
||||
if (plan == null || plan.State != (int)TwConst.State.已完成)
|
||||
@@ -329,7 +328,7 @@ namespace BLL
|
||||
{
|
||||
TwInputdetailService.DeleteById(detail.Id);
|
||||
//撤销入库,即减去库存
|
||||
TwMaterialstockService.UpdateStockNum(master.ProjectId,detail.MaterialCode, master.WarehouseCode,TwConst.InOutType.出库, detail.ActNum);
|
||||
TwMaterialstockService.UpdateStockNum(master.ProjectId, detail.MaterialCode, master.WarehouseCode, TwConst.InOutType.出库, detail.ActNum);
|
||||
}
|
||||
plan.State = (int)TwConst.State.已审核;
|
||||
TwInOutplanmasterService.Update(plan);
|
||||
@@ -347,7 +346,7 @@ namespace BLL
|
||||
{
|
||||
string cusBillCode = "";
|
||||
switch (typeInt)
|
||||
{
|
||||
{
|
||||
case TwConst.TypeInt.退料入库:
|
||||
if (category == TwConst.Category.管段)
|
||||
{
|
||||
|
||||
@@ -3,7 +3,6 @@ using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
|
||||
namespace BLL
|
||||
@@ -130,13 +129,13 @@ namespace BLL
|
||||
/// <param name="WarehouseCode"></param>
|
||||
/// <param name="inOutType"></param>
|
||||
/// <param name="StockNum"></param>
|
||||
public static void UpdateStockNum(string ProjectId, string MaterialCode, string WarehouseCode,TwConst.InOutType inOutType , decimal? StockNum)
|
||||
public static void UpdateStockNum(string ProjectId, string MaterialCode, string WarehouseCode, TwConst.InOutType inOutType, decimal? StockNum)
|
||||
{
|
||||
Model.Tw_MaterialStock table = Funs.DB.Tw_MaterialStock.FirstOrDefault(x => x.ProjectId == ProjectId && x.PipeLineMatCode == MaterialCode && x.WarehouseCode == WarehouseCode);
|
||||
//如果是入库,则库存数量加上,如果是出库,则库存数量减去
|
||||
if (inOutType==TwConst.InOutType.出库)
|
||||
if (inOutType == TwConst.InOutType.出库)
|
||||
{
|
||||
StockNum=-StockNum;//出库,库存数量减去
|
||||
StockNum = -StockNum;//出库,库存数量减去
|
||||
}
|
||||
if (table != null)
|
||||
{
|
||||
@@ -147,12 +146,12 @@ namespace BLL
|
||||
else
|
||||
{
|
||||
Model.Tw_MaterialStock newtable = new Model.Tw_MaterialStock
|
||||
{
|
||||
{
|
||||
Id = Guid.NewGuid().ToString(),
|
||||
ProjectId = ProjectId,
|
||||
PipeLineMatCode = MaterialCode,
|
||||
WarehouseCode = WarehouseCode,
|
||||
StockNum = StockNum??0,
|
||||
StockNum = StockNum ?? 0,
|
||||
};
|
||||
Funs.DB.Tw_MaterialStock.InsertOnSubmit(newtable);
|
||||
Funs.DB.SubmitChanges();
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
using FineUIPro;
|
||||
using NPOI.OpenXmlFormats.Wordprocessing;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
|
||||
namespace BLL
|
||||
@@ -27,7 +24,7 @@ namespace BLL
|
||||
var q = from x in Funs.DB.Tw_OutputDetail
|
||||
join y in Funs.DB.HJGL_Pipeline_Component on x.PipelineComponentId equals y.PipelineComponentId into yy
|
||||
from y in yy.DefaultIfEmpty()
|
||||
join mat in Funs.DB.HJGL_MaterialCodeLib on x.MaterialCode equals mat.MaterialCode into mm
|
||||
join mat in Funs.DB.HJGL_MaterialCodeLib on x.MaterialCode equals mat.MaterialCode into mm
|
||||
from mat in mm.DefaultIfEmpty()
|
||||
join master in Funs.DB.Tw_OutputMaster on x.OutputMasterId equals master.Id into masters
|
||||
from master in masters.DefaultIfEmpty()
|
||||
@@ -37,14 +34,14 @@ namespace BLL
|
||||
(string.IsNullOrEmpty(table.Id) || x.Id.Contains(table.Id)) &&
|
||||
(string.IsNullOrEmpty(table.OutputMasterId) || x.OutputMasterId.Contains(table.OutputMasterId)) &&
|
||||
(string.IsNullOrEmpty(table.PipelineComponentId) || x.PipelineComponentId.Contains(table.PipelineComponentId)) &&
|
||||
(string.IsNullOrEmpty(table.MaterialCode) || x.MaterialCode.Contains(table.MaterialCode))&&
|
||||
(table.TypeInt ==null || master.TypeInt==table.TypeInt)
|
||||
(string.IsNullOrEmpty(table.MaterialCode) || x.MaterialCode.Contains(table.MaterialCode)) &&
|
||||
(table.TypeInt == null || master.TypeInt == table.TypeInt)
|
||||
select new Model.Tw_InOutDetailOutput
|
||||
{
|
||||
Id = x.Id,
|
||||
OutputMasterId = x.OutputMasterId,
|
||||
CusBillCode=master.CusBillCode,
|
||||
TypeInt=master.TypeInt,
|
||||
CusBillCode = master.CusBillCode,
|
||||
TypeInt = master.TypeInt,
|
||||
PipelineComponentId = x.PipelineComponentId,
|
||||
MaterialCode = x.MaterialCode,
|
||||
PlanNum = x.PlanNum,
|
||||
@@ -52,7 +49,7 @@ namespace BLL
|
||||
PipelineComponentCode = y.PipelineComponentCode,
|
||||
MaterialName = mat.MaterialName,
|
||||
StockNum = stock.StockNum ?? 0,
|
||||
DiffNum = (x.ActNum??0) - (x.PlanNum??0),
|
||||
DiffNum = (x.ActNum ?? 0) - (x.PlanNum ?? 0),
|
||||
MaterialDef = mat.MaterialDef
|
||||
}
|
||||
;
|
||||
@@ -134,20 +131,20 @@ namespace BLL
|
||||
|
||||
public static IEnumerable GetPrintListByOutputMasterIds(List<string> outputMasterIds)
|
||||
{
|
||||
var q= from x in Funs.DB.Tw_OutputDetail
|
||||
join y in Funs.DB.HJGL_MaterialCodeLib on x.MaterialCode equals y.MaterialCode
|
||||
join master in Funs.DB.Tw_OutputMaster on x.OutputMasterId equals master.Id
|
||||
where outputMasterIds.Contains(x.OutputMasterId)
|
||||
orderby master.CusBillCode
|
||||
select new
|
||||
{
|
||||
出库单编号 = master.CusBillCode,
|
||||
材料编码 = x.MaterialCode,
|
||||
材料名称 = y.MaterialName,
|
||||
材料描述 = y.MaterialDef,
|
||||
计划数量 = x.PlanNum,
|
||||
实际数量 = x.ActNum,
|
||||
};
|
||||
var q = from x in Funs.DB.Tw_OutputDetail
|
||||
join y in Funs.DB.HJGL_MaterialCodeLib on x.MaterialCode equals y.MaterialCode
|
||||
join master in Funs.DB.Tw_OutputMaster on x.OutputMasterId equals master.Id
|
||||
where outputMasterIds.Contains(x.OutputMasterId)
|
||||
orderby master.CusBillCode
|
||||
select new
|
||||
{
|
||||
出库单编号 = master.CusBillCode,
|
||||
材料编码 = x.MaterialCode,
|
||||
材料名称 = y.MaterialName,
|
||||
材料描述 = y.MaterialDef,
|
||||
计划数量 = x.PlanNum,
|
||||
实际数量 = x.ActNum,
|
||||
};
|
||||
return q;
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,6 @@ using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
|
||||
namespace BLL
|
||||
@@ -13,7 +12,7 @@ namespace BLL
|
||||
/// 入库单逻辑层
|
||||
/// </summary>
|
||||
public static class TwOutputmasterService
|
||||
{
|
||||
{
|
||||
#region 获取列表
|
||||
/// <summary>
|
||||
/// 记录数
|
||||
@@ -26,12 +25,12 @@ namespace BLL
|
||||
public static IQueryable<Model.Tw_InOutMasterOutput> GetModle(Model.Tw_InOutMasterOutput table)
|
||||
{
|
||||
var q = from x in Funs.DB.Tw_OutputMaster
|
||||
join y in Funs.DB.Tw_InOutPlanMaster on x.InOutPlanMasterId equals y.Id into yy
|
||||
from y in yy.DefaultIfEmpty()
|
||||
//join z in Funs.DB.HJGL_WeldTask on y.WeldTaskId equals z.WeldTaskId into zz
|
||||
//from z in zz.DefaultIfEmpty()
|
||||
join y in Funs.DB.Tw_InOutPlanMaster on x.InOutPlanMasterId equals y.Id into yy
|
||||
from y in yy.DefaultIfEmpty()
|
||||
//join z in Funs.DB.HJGL_WeldTask on y.WeldTaskId equals z.WeldTaskId into zz
|
||||
//from z in zz.DefaultIfEmpty()
|
||||
join person in Funs.DB.Person_Persons on x.CreateMan equals person.PersonId into persons
|
||||
from person in persons.DefaultIfEmpty()
|
||||
from person in persons.DefaultIfEmpty()
|
||||
join auditperson in Funs.DB.Person_Persons on x.AuditMan equals auditperson.PersonId into auditpersons
|
||||
from auditperson in auditpersons.DefaultIfEmpty()
|
||||
join auditperson2 in Funs.DB.Person_Persons on x.AuditMan2 equals auditperson2.PersonId into auditpersons2
|
||||
@@ -39,48 +38,48 @@ namespace BLL
|
||||
join warehouseperson in Funs.DB.Person_Persons on x.WarehouseMan equals warehouseperson.PersonId into warehousepersons
|
||||
from warehouseperson in warehousepersons.DefaultIfEmpty()
|
||||
join unit in Funs.DB.Base_Unit on x.ReqUnitId equals unit.UnitId into units
|
||||
from unit in units.DefaultIfEmpty()
|
||||
where
|
||||
(string.IsNullOrEmpty(table.Id) || x.Id.Contains(table.Id)) &&
|
||||
(string.IsNullOrEmpty(table.InOutPlanMasterId) || x.InOutPlanMasterId .Contains(table.InOutPlanMasterId)) &&
|
||||
(string.IsNullOrEmpty(table.ProjectId) || x.ProjectId.Contains(table.ProjectId)) &&
|
||||
(string.IsNullOrEmpty(table.CusBillCode) || x.CusBillCode.Contains(table.CusBillCode)) &&
|
||||
(string.IsNullOrEmpty(table.WarehouseCode) || x.WarehouseCode.Contains(table.WarehouseCode)) &&
|
||||
(string.IsNullOrEmpty(table.CreateMan) || x.CreateMan.Contains(table.CreateMan)) &&
|
||||
(string.IsNullOrEmpty(table.ReqUnitId) || x.ReqUnitId.Contains(table.ReqUnitId)) &&
|
||||
(string.IsNullOrEmpty(table.UnitWorkId) || y.WeldTaskId.Contains(table.UnitWorkId)) &&
|
||||
(table.TypeInt == null || x.TypeInt == table.TypeInt) &&
|
||||
(table.Category == null || x.Category == table.Category) &&
|
||||
(table.State == null || x.State == table.State)
|
||||
orderby x.CreateDate descending
|
||||
select new Model.Tw_InOutMasterOutput
|
||||
{
|
||||
Id = x.Id,
|
||||
ProjectId = x.ProjectId,
|
||||
CusBillCode = x.CusBillCode,
|
||||
InOutPlanMasterId = x.InOutPlanMasterId,
|
||||
WarehouseCode = x.WarehouseCode,
|
||||
Category = x.Category,
|
||||
Source = x.Source,
|
||||
TypeInt = x.TypeInt,
|
||||
State = x.State,
|
||||
CreateMan = x.CreateMan,
|
||||
CreateManName = person.PersonName,
|
||||
CreateDate = x.CreateDate,
|
||||
ReqUnitId = x.ReqUnitId,
|
||||
ReqUnitName = unit.UnitName,
|
||||
WeldTaskId = y.WeldTaskId,
|
||||
AuditMan = x.AuditMan,
|
||||
AuditManName = auditperson.PersonName,
|
||||
AuditDate = x.AuditDate,
|
||||
AuditMan2 = x.AuditMan2,
|
||||
AuditManName2 = auditperson2.PersonName,
|
||||
AuditDate2 = x.AuditDate2,
|
||||
WarehouseMan = x.WarehouseMan,
|
||||
WarehouseDate = x.WarehouseDate,
|
||||
WarehouseManName = warehouseperson.PersonName,
|
||||
Remark=y.Remark
|
||||
};
|
||||
from unit in units.DefaultIfEmpty()
|
||||
where
|
||||
(string.IsNullOrEmpty(table.Id) || x.Id.Contains(table.Id)) &&
|
||||
(string.IsNullOrEmpty(table.InOutPlanMasterId) || x.InOutPlanMasterId.Contains(table.InOutPlanMasterId)) &&
|
||||
(string.IsNullOrEmpty(table.ProjectId) || x.ProjectId.Contains(table.ProjectId)) &&
|
||||
(string.IsNullOrEmpty(table.CusBillCode) || x.CusBillCode.Contains(table.CusBillCode)) &&
|
||||
(string.IsNullOrEmpty(table.WarehouseCode) || x.WarehouseCode.Contains(table.WarehouseCode)) &&
|
||||
(string.IsNullOrEmpty(table.CreateMan) || x.CreateMan.Contains(table.CreateMan)) &&
|
||||
(string.IsNullOrEmpty(table.ReqUnitId) || x.ReqUnitId.Contains(table.ReqUnitId)) &&
|
||||
(string.IsNullOrEmpty(table.UnitWorkId) || y.WeldTaskId.Contains(table.UnitWorkId)) &&
|
||||
(table.TypeInt == null || x.TypeInt == table.TypeInt) &&
|
||||
(table.Category == null || x.Category == table.Category) &&
|
||||
(table.State == null || x.State == table.State)
|
||||
orderby x.CreateDate descending
|
||||
select new Model.Tw_InOutMasterOutput
|
||||
{
|
||||
Id = x.Id,
|
||||
ProjectId = x.ProjectId,
|
||||
CusBillCode = x.CusBillCode,
|
||||
InOutPlanMasterId = x.InOutPlanMasterId,
|
||||
WarehouseCode = x.WarehouseCode,
|
||||
Category = x.Category,
|
||||
Source = x.Source,
|
||||
TypeInt = x.TypeInt,
|
||||
State = x.State,
|
||||
CreateMan = x.CreateMan,
|
||||
CreateManName = person.PersonName,
|
||||
CreateDate = x.CreateDate,
|
||||
ReqUnitId = x.ReqUnitId,
|
||||
ReqUnitName = unit.UnitName,
|
||||
WeldTaskId = y.WeldTaskId,
|
||||
AuditMan = x.AuditMan,
|
||||
AuditManName = auditperson.PersonName,
|
||||
AuditDate = x.AuditDate,
|
||||
AuditMan2 = x.AuditMan2,
|
||||
AuditManName2 = auditperson2.PersonName,
|
||||
AuditDate2 = x.AuditDate2,
|
||||
WarehouseMan = x.WarehouseMan,
|
||||
WarehouseDate = x.WarehouseDate,
|
||||
WarehouseManName = warehouseperson.PersonName,
|
||||
Remark = y.Remark
|
||||
};
|
||||
|
||||
return q;
|
||||
}
|
||||
@@ -101,39 +100,39 @@ namespace BLL
|
||||
}
|
||||
var result = q.Skip(grid1.PageSize * grid1.PageIndex).Take(grid1.PageSize).ToList();
|
||||
return from x in result
|
||||
select new Model.Tw_InOutMasterOutput
|
||||
{
|
||||
Id = x.Id,
|
||||
ProjectId = x.ProjectId,
|
||||
CusBillCode = x.CusBillCode,
|
||||
WarehouseCode = x.WarehouseCode,
|
||||
InOutPlanMasterId = x.InOutPlanMasterId,
|
||||
Source = x.Source,
|
||||
TypeInt = x.TypeInt,
|
||||
State = x.State,
|
||||
Category= x.Category,
|
||||
CreateMan = x.CreateMan,
|
||||
CreateManName = x.CreateManName,
|
||||
CreateDate = x.CreateDate,
|
||||
ReqUnitId = x.ReqUnitId,
|
||||
ReqUnitName = x.ReqUnitName,
|
||||
TypeString = TwConst.TypeIntMap.FirstOrDefault(y => y.Value == x.TypeInt).Key,
|
||||
StateString = TwConst.StateMap.FirstOrDefault(y => y.Value == x.State).Key,
|
||||
CategoryString = TwConst.CategoryMap.FirstOrDefault(y => y.Value == x.Category).Key,
|
||||
WeldTaskId = x.WeldTaskId,
|
||||
WeldTaskCode = x.WeldTaskId != null ? x.WeldTaskId.Contains('|') ? Funs.DB.HJGL_WeldTask.FirstOrDefault(e => e.UnitWorkId == x.WeldTaskId.Split('|')[0].ToString() && e.UnitId == x.WeldTaskId.Split('|')[1].ToString() && e.TaskDate.Value.Date == DateTime.ParseExact(x.WeldTaskId.Split('|')[2].ToString(), "yyyyMMdd", null).Date)?.TaskCode : "" : "",
|
||||
UnitWorkId= x.WeldTaskId != null? x.WeldTaskId.Split('|')[0].ToString():null,
|
||||
AuditMan = x.AuditMan,
|
||||
AuditManName = x.AuditManName,
|
||||
AuditDate = x.AuditDate,
|
||||
AuditMan2 = x.AuditMan2,
|
||||
AuditManName2 = x.AuditManName2,
|
||||
AuditDate2 = x.AuditDate2,
|
||||
WarehouseMan = x.WarehouseMan,
|
||||
WarehouseManName = x.WarehouseManName,
|
||||
WarehouseDate = x.WarehouseDate
|
||||
select new Model.Tw_InOutMasterOutput
|
||||
{
|
||||
Id = x.Id,
|
||||
ProjectId = x.ProjectId,
|
||||
CusBillCode = x.CusBillCode,
|
||||
WarehouseCode = x.WarehouseCode,
|
||||
InOutPlanMasterId = x.InOutPlanMasterId,
|
||||
Source = x.Source,
|
||||
TypeInt = x.TypeInt,
|
||||
State = x.State,
|
||||
Category = x.Category,
|
||||
CreateMan = x.CreateMan,
|
||||
CreateManName = x.CreateManName,
|
||||
CreateDate = x.CreateDate,
|
||||
ReqUnitId = x.ReqUnitId,
|
||||
ReqUnitName = x.ReqUnitName,
|
||||
TypeString = TwConst.TypeIntMap.FirstOrDefault(y => y.Value == x.TypeInt).Key,
|
||||
StateString = TwConst.StateMap.FirstOrDefault(y => y.Value == x.State).Key,
|
||||
CategoryString = TwConst.CategoryMap.FirstOrDefault(y => y.Value == x.Category).Key,
|
||||
WeldTaskId = x.WeldTaskId,
|
||||
WeldTaskCode = x.WeldTaskId != null ? x.WeldTaskId.Contains('|') ? Funs.DB.HJGL_WeldTask.FirstOrDefault(e => e.UnitWorkId == x.WeldTaskId.Split('|')[0].ToString() && e.UnitId == x.WeldTaskId.Split('|')[1].ToString() && e.TaskDate.Value.Date == DateTime.ParseExact(x.WeldTaskId.Split('|')[2].ToString(), "yyyyMMdd", null).Date)?.TaskCode : "" : "",
|
||||
UnitWorkId = x.WeldTaskId != null ? x.WeldTaskId.Split('|')[0].ToString() : null,
|
||||
AuditMan = x.AuditMan,
|
||||
AuditManName = x.AuditManName,
|
||||
AuditDate = x.AuditDate,
|
||||
AuditMan2 = x.AuditMan2,
|
||||
AuditManName2 = x.AuditManName2,
|
||||
AuditDate2 = x.AuditDate2,
|
||||
WarehouseMan = x.WarehouseMan,
|
||||
WarehouseManName = x.WarehouseManName,
|
||||
WarehouseDate = x.WarehouseDate
|
||||
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
public static List<Tw_InOutMasterOutput> GetListData(Model.Tw_InOutMasterOutput table)
|
||||
@@ -146,39 +145,39 @@ namespace BLL
|
||||
}
|
||||
var result = q.ToList();
|
||||
return (from x in result
|
||||
select new Model.Tw_InOutMasterOutput
|
||||
{
|
||||
Id = x.Id,
|
||||
ProjectId = x.ProjectId,
|
||||
CusBillCode = x.CusBillCode,
|
||||
InOutPlanMasterId = x.InOutPlanMasterId,
|
||||
WarehouseCode = x.WarehouseCode,
|
||||
Source = x.Source,
|
||||
TypeInt = x.TypeInt,
|
||||
State = x.State,
|
||||
Category = x.Category,
|
||||
CreateMan = x.CreateMan,
|
||||
CreateManName = x.CreateManName,
|
||||
CreateDate = x.CreateDate,
|
||||
ReqUnitId = x.ReqUnitId,
|
||||
ReqUnitName = x.ReqUnitName,
|
||||
TypeString = TwConst.TypeIntMap.FirstOrDefault(y => y.Value == x.TypeInt).Key,
|
||||
StateString = TwConst.StateMap.FirstOrDefault(y => y.Value == x.State).Key,
|
||||
CategoryString = TwConst.CategoryMap.FirstOrDefault(y => y.Value == x.Category).Key,
|
||||
WeldTaskId = x.WeldTaskId,
|
||||
WeldTaskCode = x.WeldTaskId != null ? x.WeldTaskId.Contains('|') ? Funs.DB.HJGL_WeldTask.FirstOrDefault(e => e.UnitWorkId == x.WeldTaskId.Split('|')[0].ToString() && e.UnitId == x.WeldTaskId.Split('|')[1].ToString() && e.TaskDate.Value.Date == DateTime.ParseExact(x.WeldTaskId.Split('|')[2].ToString(), "yyyyMMdd", null).Date)?.TaskCode : "" : "",
|
||||
UnitWorkId = x.WeldTaskId != null ? x.WeldTaskId.Split('|')[0].ToString() : null,
|
||||
AuditMan = x.AuditMan,
|
||||
AuditManName = x.AuditManName,
|
||||
AuditDate = x.AuditDate,
|
||||
AuditMan2 = x.AuditMan2,
|
||||
AuditManName2 = x.AuditManName2,
|
||||
AuditDate2 = x.AuditDate2,
|
||||
WarehouseMan = x.WarehouseMan,
|
||||
WarehouseManName = x.WarehouseManName,
|
||||
WarehouseDate = x.WarehouseDate
|
||||
select new Model.Tw_InOutMasterOutput
|
||||
{
|
||||
Id = x.Id,
|
||||
ProjectId = x.ProjectId,
|
||||
CusBillCode = x.CusBillCode,
|
||||
InOutPlanMasterId = x.InOutPlanMasterId,
|
||||
WarehouseCode = x.WarehouseCode,
|
||||
Source = x.Source,
|
||||
TypeInt = x.TypeInt,
|
||||
State = x.State,
|
||||
Category = x.Category,
|
||||
CreateMan = x.CreateMan,
|
||||
CreateManName = x.CreateManName,
|
||||
CreateDate = x.CreateDate,
|
||||
ReqUnitId = x.ReqUnitId,
|
||||
ReqUnitName = x.ReqUnitName,
|
||||
TypeString = TwConst.TypeIntMap.FirstOrDefault(y => y.Value == x.TypeInt).Key,
|
||||
StateString = TwConst.StateMap.FirstOrDefault(y => y.Value == x.State).Key,
|
||||
CategoryString = TwConst.CategoryMap.FirstOrDefault(y => y.Value == x.Category).Key,
|
||||
WeldTaskId = x.WeldTaskId,
|
||||
WeldTaskCode = x.WeldTaskId != null ? x.WeldTaskId.Contains('|') ? Funs.DB.HJGL_WeldTask.FirstOrDefault(e => e.UnitWorkId == x.WeldTaskId.Split('|')[0].ToString() && e.UnitId == x.WeldTaskId.Split('|')[1].ToString() && e.TaskDate.Value.Date == DateTime.ParseExact(x.WeldTaskId.Split('|')[2].ToString(), "yyyyMMdd", null).Date)?.TaskCode : "" : "",
|
||||
UnitWorkId = x.WeldTaskId != null ? x.WeldTaskId.Split('|')[0].ToString() : null,
|
||||
AuditMan = x.AuditMan,
|
||||
AuditManName = x.AuditManName,
|
||||
AuditDate = x.AuditDate,
|
||||
AuditMan2 = x.AuditMan2,
|
||||
AuditManName2 = x.AuditManName2,
|
||||
AuditDate2 = x.AuditDate2,
|
||||
WarehouseMan = x.WarehouseMan,
|
||||
WarehouseManName = x.WarehouseManName,
|
||||
WarehouseDate = x.WarehouseDate
|
||||
|
||||
}).ToList();
|
||||
}).ToList();
|
||||
}
|
||||
|
||||
#endregion
|
||||
@@ -204,7 +203,7 @@ namespace BLL
|
||||
State = newtable.State,
|
||||
CreateMan = newtable.CreateMan,
|
||||
CreateDate = newtable.CreateDate,
|
||||
ReqUnitId = newtable.ReqUnitId,
|
||||
ReqUnitId = newtable.ReqUnitId,
|
||||
AuditMan = newtable.AuditMan,
|
||||
AuditDate = newtable.AuditDate,
|
||||
AuditMan2 = newtable.AuditMan2,
|
||||
@@ -263,28 +262,28 @@ namespace BLL
|
||||
{
|
||||
//获取出库单
|
||||
var planQueryModel = new Tw_InOutMasterOutput();
|
||||
planQueryModel.Id = planId;
|
||||
var plan = TwInOutplanmasterService.GetListData(planQueryModel).FirstOrDefault();
|
||||
if (plan == null || plan.State != (int)TwConst.State.已审核)
|
||||
planQueryModel.Id = planId;
|
||||
var plan = TwInOutplanmasterService.GetListData(planQueryModel).FirstOrDefault();
|
||||
if (plan == null || plan.State != (int)TwConst.State.已审核)
|
||||
{
|
||||
return;
|
||||
}
|
||||
//判断是否已经生成过出库单
|
||||
var queryIsExitInMaster = new Tw_InOutMasterOutput();
|
||||
queryIsExitInMaster.InOutPlanMasterId = planId;
|
||||
queryIsExitInMaster.TypeInt= plan.TypeInt;
|
||||
queryIsExitInMaster.TypeInt = plan.TypeInt;
|
||||
var IsExitInMaster = GetModle(queryIsExitInMaster).FirstOrDefault();
|
||||
if (IsExitInMaster != null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
//生成出库单
|
||||
var master = new Model.Tw_OutputMaster()
|
||||
{
|
||||
Id = Guid.NewGuid().ToString(),
|
||||
InOutPlanMasterId = plan.Id,
|
||||
ProjectId = plan.ProjectId,
|
||||
CusBillCode = GetCusBillCode(plan.WeldTaskCode, (TwConst.TypeInt)plan.TypeInt, (BLL.TwConst.Category)plan.Category,plan.CusBillCode),
|
||||
CusBillCode = GetCusBillCode(plan.WeldTaskCode, (TwConst.TypeInt)plan.TypeInt, (BLL.TwConst.Category)plan.Category, plan.CusBillCode),
|
||||
WarehouseCode = plan.WarehouseCode,
|
||||
Category = plan.Category,
|
||||
Source = plan.Source,
|
||||
@@ -299,8 +298,8 @@ namespace BLL
|
||||
AuditDate2 = plan.AuditDate2,
|
||||
WarehouseMan = plan.WarehouseMan,
|
||||
WarehouseDate = plan.WarehouseDate,
|
||||
|
||||
};
|
||||
|
||||
};
|
||||
Add(master);
|
||||
//生成出库单明细
|
||||
foreach (var detail in detailLists)
|
||||
@@ -318,7 +317,7 @@ namespace BLL
|
||||
|
||||
}
|
||||
plan.State = (int)TwConst.State.已完成;
|
||||
TwInOutplanmasterService.Update(plan);
|
||||
TwInOutplanmasterService.Update(plan);
|
||||
}
|
||||
/// <summary>
|
||||
/// 根据计划单撤销出库单
|
||||
@@ -346,8 +345,8 @@ namespace BLL
|
||||
//撤销出库,即增加库存
|
||||
TwMaterialstockService.UpdateStockNum(master.ProjectId, detail.MaterialCode, master.WarehouseCode, TwConst.InOutType.入库, detail.ActNum);
|
||||
}
|
||||
var planModel= TwInOutplanmasterService.GetById(planId);
|
||||
planModel.State= (int)TwConst.State.已审核;
|
||||
var planModel = TwInOutplanmasterService.GetById(planId);
|
||||
planModel.State = (int)TwConst.State.已审核;
|
||||
planModel.WarehouseMan = null;
|
||||
planModel.WarehouseDate = null;
|
||||
TwInOutplanmasterService.Update(planModel);
|
||||
|
||||
Reference in New Issue
Block a user