Switch warehouse matching to use IDs

This commit is contained in:
2026-06-24 23:25:06 +08:00
parent 4670220614
commit bd9b5a6f4d
27 changed files with 776 additions and 419 deletions
@@ -0,0 +1,162 @@
/*
用途:
1. 为材料出入库和库存表补充 WarehouseId 字段。
2. 将历史 WarehouseCode 中保存的仓库名称/主键统一回填到 WarehouseId。
3. 库存表按 项目+材料主编码+仓库主键 合并重复库存。
执行前建议先备份数据库,并先执行最后的“未匹配检查”确认是否存在重名或缺失仓库。
*/
SET XACT_ABORT ON;
BEGIN TRAN;
IF COL_LENGTH('dbo.Tw_InOutPlanMaster', 'WarehouseId') IS NULL
BEGIN
ALTER TABLE dbo.Tw_InOutPlanMaster ADD WarehouseId NVARCHAR(50) NULL;
END;
IF COL_LENGTH('dbo.Tw_InputMaster', 'WarehouseId') IS NULL
BEGIN
ALTER TABLE dbo.Tw_InputMaster ADD WarehouseId NVARCHAR(50) NULL;
END;
IF COL_LENGTH('dbo.Tw_OutputMaster', 'WarehouseId') IS NULL
BEGIN
ALTER TABLE dbo.Tw_OutputMaster ADD WarehouseId NVARCHAR(50) NULL;
END;
IF COL_LENGTH('dbo.Tw_MaterialStock', 'WarehouseId') IS NULL
BEGIN
ALTER TABLE dbo.Tw_MaterialStock ADD WarehouseId NVARCHAR(50) NULL;
END;
IF EXISTS (
SELECT 1
FROM dbo.Base_Warehouse
GROUP BY ProjectId, WarehouseName
HAVING COUNT(1) > 1
)
BEGIN
THROW 51000, N'同一项目存在重名仓库,历史 WarehouseCode 名称数据无法唯一回填,请先处理 Base_Warehouse 重名数据。', 1;
END;
/* 历史数据中 WarehouseCode 可能保存仓库名称,也可能已经保存 WarehouseId,这里两种都兼容。 */
UPDATE m
SET
m.WarehouseId = w.WarehouseId,
m.WarehouseCode = w.WarehouseName
FROM dbo.Tw_InOutPlanMaster AS m
INNER JOIN dbo.Base_Warehouse AS w
ON w.ProjectId = m.ProjectId
AND (w.WarehouseId = m.WarehouseCode OR w.WarehouseName = m.WarehouseCode OR w.WarehouseId = m.WarehouseId)
WHERE ISNULL(m.WarehouseId, '') <> w.WarehouseId
OR ISNULL(m.WarehouseCode, '') <> w.WarehouseName;
UPDATE m
SET
m.WarehouseId = w.WarehouseId,
m.WarehouseCode = w.WarehouseName
FROM dbo.Tw_InputMaster AS m
INNER JOIN dbo.Base_Warehouse AS w
ON w.ProjectId = m.ProjectId
AND (w.WarehouseId = m.WarehouseCode OR w.WarehouseName = m.WarehouseCode OR w.WarehouseId = m.WarehouseId)
WHERE ISNULL(m.WarehouseId, '') <> w.WarehouseId
OR ISNULL(m.WarehouseCode, '') <> w.WarehouseName;
UPDATE m
SET
m.WarehouseId = w.WarehouseId,
m.WarehouseCode = w.WarehouseName
FROM dbo.Tw_OutputMaster AS m
INNER JOIN dbo.Base_Warehouse AS w
ON w.ProjectId = m.ProjectId
AND (w.WarehouseId = m.WarehouseCode OR w.WarehouseName = m.WarehouseCode OR w.WarehouseId = m.WarehouseId)
WHERE ISNULL(m.WarehouseId, '') <> w.WarehouseId
OR ISNULL(m.WarehouseCode, '') <> w.WarehouseName;
UPDATE s
SET
s.WarehouseId = w.WarehouseId,
s.WarehouseCode = w.WarehouseName
FROM dbo.Tw_MaterialStock AS s
INNER JOIN dbo.Base_Warehouse AS w
ON w.ProjectId = s.ProjectId
AND (w.WarehouseId = s.WarehouseCode OR w.WarehouseName = s.WarehouseCode OR w.WarehouseId = s.WarehouseId)
WHERE ISNULL(s.WarehouseId, '') <> w.WarehouseId
OR ISNULL(s.WarehouseCode, '') <> w.WarehouseName;
/* 回填后,历史上同一仓库可能因“名称”和“主键”各有一条库存记录,这里合并为一条。 */
IF OBJECT_ID('tempdb..#StockMerge') IS NOT NULL
BEGIN
DROP TABLE #StockMerge;
END;
SELECT
ProjectId,
PipeLineMatCode,
WarehouseId,
MIN(Id) AS KeepId,
SUM(ISNULL(StockNum, 0)) AS TotalStock
INTO #StockMerge
FROM dbo.Tw_MaterialStock
WHERE WarehouseId IS NOT NULL
GROUP BY ProjectId, PipeLineMatCode, WarehouseId
HAVING COUNT(1) > 1;
UPDATE s
SET s.StockNum = m.TotalStock
FROM dbo.Tw_MaterialStock AS s
INNER JOIN #StockMerge AS m ON m.KeepId = s.Id;
DELETE s
FROM dbo.Tw_MaterialStock AS s
INNER JOIN #StockMerge AS m
ON m.ProjectId = s.ProjectId
AND m.PipeLineMatCode = s.PipeLineMatCode
AND m.WarehouseId = s.WarehouseId
AND s.Id <> m.KeepId;
IF NOT EXISTS (SELECT 1 FROM sys.indexes WHERE name = 'IX_Tw_InOutPlanMaster_Project_WarehouseId' AND object_id = OBJECT_ID('dbo.Tw_InOutPlanMaster'))
BEGIN
CREATE INDEX IX_Tw_InOutPlanMaster_Project_WarehouseId ON dbo.Tw_InOutPlanMaster(ProjectId, WarehouseId);
END;
IF NOT EXISTS (SELECT 1 FROM sys.indexes WHERE name = 'IX_Tw_InputMaster_Project_WarehouseId' AND object_id = OBJECT_ID('dbo.Tw_InputMaster'))
BEGIN
CREATE INDEX IX_Tw_InputMaster_Project_WarehouseId ON dbo.Tw_InputMaster(ProjectId, WarehouseId);
END;
IF NOT EXISTS (SELECT 1 FROM sys.indexes WHERE name = 'IX_Tw_OutputMaster_Project_WarehouseId' AND object_id = OBJECT_ID('dbo.Tw_OutputMaster'))
BEGIN
CREATE INDEX IX_Tw_OutputMaster_Project_WarehouseId ON dbo.Tw_OutputMaster(ProjectId, WarehouseId);
END;
IF NOT EXISTS (SELECT 1 FROM sys.indexes WHERE name = 'IX_Tw_MaterialStock_Project_Material_WarehouseId' AND object_id = OBJECT_ID('dbo.Tw_MaterialStock'))
BEGIN
CREATE INDEX IX_Tw_MaterialStock_Project_Material_WarehouseId ON dbo.Tw_MaterialStock(ProjectId, PipeLineMatCode, WarehouseId);
END;
COMMIT TRAN;
/* 未匹配检查:这些记录需要人工确认仓库名称是否错误、是否重名或是否缺少 Base_Warehouse 数据。 */
SELECT 'Tw_InOutPlanMaster' AS TableName, Id, ProjectId, WarehouseCode, WarehouseId
FROM dbo.Tw_InOutPlanMaster
WHERE ISNULL(WarehouseCode, '') <> '' AND ISNULL(WarehouseId, '') = ''
UNION ALL
SELECT 'Tw_InputMaster' AS TableName, Id, ProjectId, WarehouseCode, WarehouseId
FROM dbo.Tw_InputMaster
WHERE ISNULL(WarehouseCode, '') <> '' AND ISNULL(WarehouseId, '') = ''
UNION ALL
SELECT 'Tw_OutputMaster' AS TableName, Id, ProjectId, WarehouseCode, WarehouseId
FROM dbo.Tw_OutputMaster
WHERE ISNULL(WarehouseCode, '') <> '' AND ISNULL(WarehouseId, '') = ''
UNION ALL
SELECT 'Tw_MaterialStock' AS TableName, Id, ProjectId, WarehouseCode, WarehouseId
FROM dbo.Tw_MaterialStock
WHERE ISNULL(WarehouseCode, '') <> '' AND ISNULL(WarehouseId, '') = '';
/* 仓库重名检查:如果同一项目有重名仓库,历史名称数据无法唯一回填,需要先处理重名。 */
SELECT ProjectId, WarehouseName, COUNT(1) AS RepeatCount
FROM dbo.Base_Warehouse
GROUP BY ProjectId, WarehouseName
HAVING COUNT(1) > 1;
@@ -119,7 +119,9 @@ namespace BLL
ProjectId = om.ProjectId, ProjectId = om.ProjectId,
CusBillCode = om.CusBillCode, CusBillCode = om.CusBillCode,
InOutPlanMasterId = om.InOutPlanMasterId, InOutPlanMasterId = om.InOutPlanMasterId,
WarehouseId = om.WarehouseId,
WarehouseCode = om.WarehouseCode, WarehouseCode = om.WarehouseCode,
WarehouseName = om.WarehouseCode,
Source = om.Source, Source = om.Source,
TypeInt = om.TypeInt, TypeInt = om.TypeInt,
State = om.State, State = om.State,
@@ -160,7 +162,9 @@ namespace BLL
ProjectId = om.ProjectId, ProjectId = om.ProjectId,
CusBillCode = om.CusBillCode, CusBillCode = om.CusBillCode,
InOutPlanMasterId = om.InOutPlanMasterId, InOutPlanMasterId = om.InOutPlanMasterId,
WarehouseId = om.WarehouseId,
WarehouseCode = om.WarehouseCode, WarehouseCode = om.WarehouseCode,
WarehouseName = om.WarehouseCode,
Source = om.Source, Source = om.Source,
TypeInt = om.TypeInt, TypeInt = om.TypeInt,
State = om.State, State = om.State,
+10 -7
View File
@@ -13,7 +13,10 @@ namespace BLL
{ {
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{ {
string WarehouseId = Base_WarehouseService.GetWarehouseList(projectid).Where(x => x.WarehouseName == WarehouseCode).Select(x => x.WarehouseId).FirstOrDefault(); string WarehouseId = Base_WarehouseService.GetWarehouseList(projectid)
.Where(x => x.WarehouseId == WarehouseCode || x.WarehouseName == WarehouseCode)
.Select(x => x.WarehouseId)
.FirstOrDefault();
///所需材料数量列表 ///所需材料数量列表
var NeedOutMateriaList = from x in db.HJGL_PipeLineMat var NeedOutMateriaList = from x in db.HJGL_PipeLineMat
join y in db.HJGL_MaterialCodeLib on x.MaterialCode equals y.MaterialCode join y in db.HJGL_MaterialCodeLib on x.MaterialCode equals y.MaterialCode
@@ -30,7 +33,7 @@ namespace BLL
var RealInMateriaList = (from x in db.Tw_InputDetail var RealInMateriaList = (from x in db.Tw_InputDetail
join master in db.Tw_InputMaster on x.InputMasterId equals master.Id join master in db.Tw_InputMaster on x.InputMasterId 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
where master.ProjectId == projectid && master.WarehouseCode == WarehouseCode where master.ProjectId == projectid && master.WarehouseId == WarehouseId
group x by x.MaterialCode group x by x.MaterialCode
into g into g
where (string.IsNullOrEmpty(materialCode) || g.Key.Contains(materialCode)) where (string.IsNullOrEmpty(materialCode) || g.Key.Contains(materialCode))
@@ -41,7 +44,7 @@ namespace BLL
}).ToList(); }).ToList();
//库存数量 //库存数量
var tw_MaterialStock = (from x in db.Tw_MaterialStock var tw_MaterialStock = (from x in db.Tw_MaterialStock
where x.WarehouseCode == WarehouseCode && x.ProjectId == projectid where x.WarehouseId == WarehouseId && x.ProjectId == projectid
select x).ToList(); select x).ToList();
var needMateriaList = NeedOutMateriaList.ToList(); var needMateriaList = NeedOutMateriaList.ToList();
@@ -98,7 +101,7 @@ namespace BLL
{ {
Tw_MaterialStockOutput twMaterialStockOutput = new Tw_MaterialStockOutput Tw_MaterialStockOutput twMaterialStockOutput = new Tw_MaterialStockOutput
{ {
WarehouseCode = warehouseCode, WarehouseId = warehouseCode,
ProjectId = projectId ProjectId = projectId
}; };
var stockList = TwMaterialstockService.GetTw_MaterialStockByModle(twMaterialStockOutput).ToList();//获取库存列表 var stockList = TwMaterialstockService.GetTw_MaterialStockByModle(twMaterialStockOutput).ToList();//获取库存列表
@@ -110,7 +113,7 @@ namespace BLL
join master in db.Tw_InOutPlanMaster on detail.InOutPlanMasterId equals master.Id join master in db.Tw_InOutPlanMaster on detail.InOutPlanMasterId equals master.Id
where master.InOutType == (int)TwConst.InOutType. where master.InOutType == (int)TwConst.InOutType.
&& (master.State == (int)TwConst.State. || master.State == (int)TwConst.State.) && (master.State == (int)TwConst.State. || master.State == (int)TwConst.State.)
&& master.WarehouseCode == warehouseCode && master.WarehouseId == warehouseCode
&& master.ProjectId == projectId && master.ProjectId == projectId
group detail by detail.MaterialCode into g group detail by detail.MaterialCode into g
select new select new
@@ -178,7 +181,7 @@ namespace BLL
List<string> pipelineIds = new List<string>(); List<string> pipelineIds = new List<string>();
pipelineIds.Add(pipelineId); pipelineIds.Add(pipelineId);
var pipelineModel = PipelineService.GetPipelineByPipelineId(pipelineId); var pipelineModel = PipelineService.GetPipelineByPipelineId(pipelineId);
string warehouseCode = BLL.Base_WarehouseService.GetWarehouseByWarehouseId(PipelineService.GetPipelineByPipelineId(pipelineModel.PipelineId).WarehouseId).WarehouseName; string warehouseCode = PipelineService.GetPipelineByPipelineId(pipelineModel.PipelineId).WarehouseId;
var PipeMatMatch = GetPipeMatMatch(pipelineModel.ProjectId, pipelineIds, warehouseCode); var PipeMatMatch = GetPipeMatMatch(pipelineModel.ProjectId, pipelineIds, warehouseCode);
var pipeMatchRate = GetPipeMatch(PipeMatMatch).FirstOrDefault(x => x.PipelineId == pipelineId); var pipeMatchRate = GetPipeMatch(PipeMatMatch).FirstOrDefault(x => x.PipelineId == pipelineId);
return pipeMatchRate?.MatchRate; return pipeMatchRate?.MatchRate;
@@ -240,7 +243,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); results = GetMatMatchOutput(requiredMaterials, masterModle.WarehouseId, masterModle.ProjectId);
return results; return results;
} }
@@ -82,12 +82,12 @@ namespace BLL
return Funs.DB.Tw_InOutPlanDetail_Relation.FirstOrDefault(x => x.Id == Id); 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 warehouseId)
{ {
int typeInt = (int)TwConst.TypeInt.; 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 && y.TypeInt != typeInt where x.PipelineId == pipelineId && y.WarehouseId == warehouseId && y.TypeInt != typeInt
select x; select x;
return q.FirstOrDefault(); return q.FirstOrDefault();
} }
+1 -1
View File
@@ -29,7 +29,7 @@ namespace BLL
from mat in mm.DefaultIfEmpty() from mat in mm.DefaultIfEmpty()
join master in Funs.DB.Tw_InOutPlanMaster on x.InOutPlanMasterId equals master.Id into masters join master in Funs.DB.Tw_InOutPlanMaster on x.InOutPlanMasterId equals master.Id into masters
from master in masters.DefaultIfEmpty() 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.WarehouseId, master.ProjectId } equals new { MaterialCode = stock.PipeLineMatCode, stock.WarehouseId, stock.ProjectId } into st
from stock in st.DefaultIfEmpty() from stock in st.DefaultIfEmpty()
where where
(string.IsNullOrEmpty(table.Id) || x.Id.Contains(table.Id)) && (string.IsNullOrEmpty(table.Id) || x.Id.Contains(table.Id)) &&
+51 -15
View File
@@ -40,12 +40,15 @@ namespace BLL
from warehouseperson in warehousepersons.DefaultIfEmpty() from warehouseperson in warehousepersons.DefaultIfEmpty()
join unit in Funs.DB.Base_Unit on x.ReqUnitId equals unit.UnitId into units join unit in Funs.DB.Base_Unit on x.ReqUnitId equals unit.UnitId into units
from unit in units.DefaultIfEmpty() from unit in units.DefaultIfEmpty()
join warehouse in Funs.DB.Base_Warehouse on x.WarehouseId equals warehouse.WarehouseId into warehouses
from warehouse in warehouses.DefaultIfEmpty()
orderby x.CreateDate descending orderby x.CreateDate descending
where where
(string.IsNullOrEmpty(table.Id) || x.Id.Contains(table.Id)) && (string.IsNullOrEmpty(table.Id) || x.Id.Contains(table.Id)) &&
(string.IsNullOrEmpty(table.ProjectId) || x.ProjectId.Contains(table.ProjectId)) && (string.IsNullOrEmpty(table.ProjectId) || x.ProjectId.Contains(table.ProjectId)) &&
(string.IsNullOrEmpty(table.CusBillCode) || x.CusBillCode.Contains(table.CusBillCode)) && (string.IsNullOrEmpty(table.CusBillCode) || x.CusBillCode.Contains(table.CusBillCode)) &&
(string.IsNullOrEmpty(table.WarehouseCode) || x.WarehouseCode.Contains(table.WarehouseCode)) && (string.IsNullOrEmpty(table.WarehouseId) || x.WarehouseId == table.WarehouseId) &&
(string.IsNullOrEmpty(table.WarehouseCode) || x.WarehouseCode.Contains(table.WarehouseCode) || x.WarehouseId.Contains(table.WarehouseCode)) &&
(string.IsNullOrEmpty(table.CreateMan) || x.CreateMan.Contains(table.CreateMan)) && (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.ReqUnitId) || x.ReqUnitId.Contains(table.ReqUnitId)) &&
@@ -60,7 +63,9 @@ namespace BLL
Id = x.Id, Id = x.Id,
ProjectId = x.ProjectId, ProjectId = x.ProjectId,
CusBillCode = x.CusBillCode, CusBillCode = x.CusBillCode,
WarehouseCode = x.WarehouseCode, WarehouseId = x.WarehouseId,
WarehouseCode = warehouse == null ? x.WarehouseCode : warehouse.WarehouseName,
WarehouseName = warehouse == null ? x.WarehouseCode : warehouse.WarehouseName,
Source = x.Source, Source = x.Source,
InOutType = x.InOutType, InOutType = x.InOutType,
TypeInt = x.TypeInt, TypeInt = x.TypeInt,
@@ -117,7 +122,9 @@ namespace BLL
Id = x.Id, Id = x.Id,
ProjectId = x.ProjectId, ProjectId = x.ProjectId,
CusBillCode = x.CusBillCode, CusBillCode = x.CusBillCode,
WarehouseId = x.WarehouseId,
WarehouseCode = x.WarehouseCode, WarehouseCode = x.WarehouseCode,
WarehouseName = x.WarehouseName,
Source = x.Source, Source = x.Source,
InOutType = x.InOutType, InOutType = x.InOutType,
TypeInt = x.TypeInt, TypeInt = x.TypeInt,
@@ -167,7 +174,9 @@ namespace BLL
Id = x.Id, Id = x.Id,
ProjectId = x.ProjectId, ProjectId = x.ProjectId,
CusBillCode = x.CusBillCode, CusBillCode = x.CusBillCode,
WarehouseId = x.WarehouseId,
WarehouseCode = x.WarehouseCode, WarehouseCode = x.WarehouseCode,
WarehouseName = x.WarehouseName,
Source = x.Source, Source = x.Source,
InOutType = x.InOutType, InOutType = x.InOutType,
TypeInt = x.TypeInt, TypeInt = x.TypeInt,
@@ -268,11 +277,13 @@ namespace BLL
responeData.message = "导入数据为空!"; responeData.message = "导入数据为空!";
return responeData; return responeData;
} }
var warehouseCodeList = temeplateDtoIns.Select(x => x.WarehouseCode).Distinct().ToList(); //获取导入文件的仓库编号 var warehouseList = Base_WarehouseService.GetWarehouseList(projectid);
var warehouseCodeList = temeplateDtoIns.Select(x => CleanImportText(x.WarehouseCode)).Distinct().ToList(); //获取导入文件的仓库
string errorWarehouseCode = ""; string errorWarehouseCode = "";
foreach (var item in warehouseCodeList) foreach (var item in warehouseCodeList)
{ {
if (!Base_WarehouseService.GetWarehouseList(projectid).Select(x => x.WarehouseName == item).Any()) var warehouse = warehouseList.FirstOrDefault(x => x.WarehouseId == item || x.WarehouseName == item);
if (warehouse == null)
{ {
errorWarehouseCode += item + ","; errorWarehouseCode += item + ",";
} }
@@ -287,6 +298,15 @@ namespace BLL
return responeData; return responeData;
//} //}
} }
foreach (var item in temeplateDtoIns)
{
var warehouse = warehouseList.FirstOrDefault(x => x.WarehouseId == CleanImportText(item.WarehouseCode) || x.WarehouseName == CleanImportText(item.WarehouseCode));
if (warehouse != null)
{
// 导入模板仍允许填仓库名称,入库申请保存时同时固化仓库主键,后续改名不影响关联。
item.WarehouseCode = warehouse.WarehouseName;
}
}
var typeString = temeplateDtoIns.Select(x => x.TypeString).Distinct().ToList(); //获取导入文件的类型 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)
{ {
@@ -362,8 +382,11 @@ namespace BLL
//通过映射实体赋值 //通过映射实体赋值
var twInOutPlanMaster = mapper.Map(CusBillCodeDtoIns).FirstOrDefault(); var twInOutPlanMaster = mapper.Map(CusBillCodeDtoIns).FirstOrDefault();
var twInOutPlanDetails = mapperDetail.Map(CusBillCodeDtoIns.Where(x => !string.IsNullOrEmpty(x.MaterialCode) && !string.IsNullOrEmpty(x.PlanNum)).ToList()); var twInOutPlanDetails = mapperDetail.Map(CusBillCodeDtoIns.Where(x => !string.IsNullOrEmpty(x.MaterialCode) && !string.IsNullOrEmpty(x.PlanNum)).ToList());
var importWarehouse = warehouseList.FirstOrDefault(x => x.WarehouseName == FirstCusBillCodeDtoIns.WarehouseCode);
twInOutPlanMaster.Id = SQLHelper.GetNewID(); twInOutPlanMaster.Id = SQLHelper.GetNewID();
twInOutPlanMaster.WarehouseId = importWarehouse?.WarehouseId;
twInOutPlanMaster.WarehouseCode = importWarehouse?.WarehouseName ?? twInOutPlanMaster.WarehouseCode;
twInOutPlanMaster.InOutType = (int)TwConst.InOutType.; twInOutPlanMaster.InOutType = (int)TwConst.InOutType.;
twInOutPlanMaster.State = (int)TwConst.State.; twInOutPlanMaster.State = (int)TwConst.State.;
@@ -457,7 +480,8 @@ namespace BLL
errors.Add("第" + rowIndex + "行,仓库,此项为必填项!"); errors.Add("第" + rowIndex + "行,仓库,此项为必填项!");
continue; continue;
} }
if (!warehouseList.Any(x => x.WarehouseName == rowWarehouseCode)) var rowWarehouse = warehouseList.FirstOrDefault(x => x.WarehouseId == rowWarehouseCode || x.WarehouseName == rowWarehouseCode);
if (rowWarehouse == null)
{ {
errors.Add("第" + rowIndex + "行,仓库[" + rowWarehouseCode + "]不存在!"); errors.Add("第" + rowIndex + "行,仓库[" + rowWarehouseCode + "]不存在!");
continue; continue;
@@ -499,16 +523,17 @@ namespace BLL
continue; continue;
} }
var stock = allStock.FirstOrDefault(x => x.WarehouseCode == rowWarehouseCode && x.Code == materialCode && x.HeatNo == heatNo && x.BatchNo == batchNo); var stock = allStock.FirstOrDefault(x => x.WarehouseId == rowWarehouse.WarehouseId && x.Code == materialCode && x.HeatNo == heatNo && x.BatchNo == batchNo);
if (stock == null) if (stock == null)
{ {
errors.Add("第" + rowIndex + "行,仓库[" + rowWarehouseCode + "]库存中不存在此材料编码/炉号/批号-" + materialCode + "/" + heatNo + "/" + batchNo); errors.Add("第" + rowIndex + "行,仓库[" + rowWarehouse.WarehouseName + "]库存中不存在此材料编码/炉号/批号-" + materialCode + "/" + heatNo + "/" + batchNo);
continue; continue;
} }
detailRows.Add(new Tw_OutHistoryImportRow detailRows.Add(new Tw_OutHistoryImportRow
{ {
WarehouseCode = stock.WarehouseCode, WarehouseId = rowWarehouse.WarehouseId,
WarehouseCode = rowWarehouse.WarehouseName,
MaterialCode = stock.PipeLineMatCode, MaterialCode = stock.PipeLineMatCode,
Code = stock.Code, Code = stock.Code,
HeatNo = stock.HeatNo, HeatNo = stock.HeatNo,
@@ -533,13 +558,14 @@ namespace BLL
return responeData; return responeData;
} }
var stockErrors = detailRows.GroupBy(x => new { x.WarehouseCode, x.MaterialCode }) var stockErrors = detailRows.GroupBy(x => new { x.WarehouseId, x.WarehouseCode, x.MaterialCode })
.Select(x => new .Select(x => new
{ {
x.Key.WarehouseId,
x.Key.WarehouseCode, x.Key.WarehouseCode,
x.Key.MaterialCode, x.Key.MaterialCode,
Num = x.Sum(y => y.Num), Num = x.Sum(y => y.Num),
Stock = allStock.FirstOrDefault(y => y.WarehouseCode == x.Key.WarehouseCode && y.PipeLineMatCode == x.Key.MaterialCode) Stock = allStock.FirstOrDefault(y => y.WarehouseId == x.Key.WarehouseId && y.PipeLineMatCode == x.Key.MaterialCode)
}) })
.Where(x => x.Stock == null || (x.Stock.StockNum ?? 0) < x.Num) .Where(x => x.Stock == null || (x.Stock.StockNum ?? 0) < x.Num)
.Select(x => "仓库[" + x.WarehouseCode + "]" + (x.Stock == null ? x.MaterialCode : x.Stock.Code + "/" + x.Stock.HeatNo + "/" + x.Stock.BatchNo) .Select(x => "仓库[" + x.WarehouseCode + "]" + (x.Stock == null ? x.MaterialCode : x.Stock.Code + "/" + x.Stock.HeatNo + "/" + x.Stock.BatchNo)
@@ -555,6 +581,7 @@ namespace BLL
int planCount = 0; int planCount = 0;
foreach (var group in detailRows.GroupBy(x => new foreach (var group in detailRows.GroupBy(x => new
{ {
x.WarehouseId,
x.WarehouseCode, x.WarehouseCode,
x.ReqUnitId, x.ReqUnitId,
OutputDate = x.OutputDate.Date, OutputDate = x.OutputDate.Date,
@@ -568,6 +595,7 @@ namespace BLL
Id = planId, Id = planId,
ProjectId = projectId, ProjectId = projectId,
CusBillCode = cusBillCode, CusBillCode = cusBillCode,
WarehouseId = group.Key.WarehouseId,
WarehouseCode = group.Key.WarehouseCode, WarehouseCode = group.Key.WarehouseCode,
WeldTaskId = unitWorkId, WeldTaskId = unitWorkId,
Source = 2, Source = 2,
@@ -667,13 +695,15 @@ namespace BLL
} }
public static void Add(Model.Tw_InOutPlanMaster newtable) public static void Add(Model.Tw_InOutPlanMaster newtable)
{ {
var warehouseName = Base_WarehouseService.GetWarehouseNameById(newtable.WarehouseId);
Model.Tw_InOutPlanMaster table = new Model.Tw_InOutPlanMaster Model.Tw_InOutPlanMaster table = new Model.Tw_InOutPlanMaster
{ {
Id = newtable.Id, Id = newtable.Id,
ProjectId = newtable.ProjectId, ProjectId = newtable.ProjectId,
CusBillCode = newtable.CusBillCode, CusBillCode = newtable.CusBillCode,
WarehouseCode = newtable.WarehouseCode, WarehouseId = newtable.WarehouseId,
WarehouseCode = warehouseName ?? newtable.WarehouseCode,
Source = newtable.Source, Source = newtable.Source,
Category = newtable.Category, Category = newtable.Category,
InOutType = newtable.InOutType, InOutType = newtable.InOutType,
@@ -704,7 +734,8 @@ namespace BLL
table.Id = newtable.Id; table.Id = newtable.Id;
table.ProjectId = newtable.ProjectId; table.ProjectId = newtable.ProjectId;
table.CusBillCode = newtable.CusBillCode; table.CusBillCode = newtable.CusBillCode;
table.WarehouseCode = newtable.WarehouseCode; table.WarehouseId = newtable.WarehouseId;
table.WarehouseCode = Base_WarehouseService.GetWarehouseNameById(newtable.WarehouseId) ?? newtable.WarehouseCode;
table.Category = newtable.Category; table.Category = newtable.Category;
table.Source = newtable.Source; table.Source = newtable.Source;
table.InOutType = newtable.InOutType; table.InOutType = newtable.InOutType;
@@ -810,6 +841,7 @@ namespace BLL
Id = Guid.NewGuid().ToString(), Id = Guid.NewGuid().ToString(),
OutputMasterId = outMaster.Id, OutputMasterId = outMaster.Id,
ProjectId = outMaster.ProjectId, ProjectId = outMaster.ProjectId,
WarehouseId = outMaster.WarehouseId,
WarehouseCode = outMaster.WarehouseCode, WarehouseCode = outMaster.WarehouseCode,
Source = 2, Source = 2,
Category = outMaster.Category, Category = outMaster.Category,
@@ -895,7 +927,7 @@ namespace BLL
public static Dictionary<string, string> GetWarehouseCode(string projectId) public static Dictionary<string, string> GetWarehouseCode(string projectId)
{ {
var q = Base_WarehouseService.GetWarehouseList(projectId).Distinct().ToDictionary(x => x.WarehouseName, x => x.WarehouseName); var q = Base_WarehouseService.GetWarehouseList(projectId).Distinct().ToDictionary(x => x.WarehouseName, x => x.WarehouseId);
return q; return q;
} }
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 = "")
@@ -1039,6 +1071,8 @@ namespace BLL
var outPlanDetailListPiece = outMateriaList.Where(x => x.MaterialName.Contains("个"));//管件 var outPlanDetailListPiece = outMateriaList.Where(x => x.MaterialName.Contains("个"));//管件
var outPlanDetailListOthere = outMateriaList.Where(x => x.MaterialName.Contains("米"));//管段 var outPlanDetailListOthere = outMateriaList.Where(x => x.MaterialName.Contains("米"));//管段
var weldTaskCode = WeldTaskService.GetWeldTaskById(weldTask.WeldTaskId)?.TaskCode; var weldTaskCode = WeldTaskService.GetWeldTaskById(weldTask.WeldTaskId)?.TaskCode;
var taskPipeline = PipelineService.GetPipelineByPipelineId(weldTask.PipelineId);
var taskWarehouse = BLL.Base_WarehouseService.GetWarehouseByWarehouseId(taskPipeline?.WarehouseId);
if (outPlanDetailListPiece.Any()) if (outPlanDetailListPiece.Any())
{ {
Model.Tw_InOutPlanMaster table = new Model.Tw_InOutPlanMaster Model.Tw_InOutPlanMaster table = new Model.Tw_InOutPlanMaster
@@ -1047,7 +1081,8 @@ namespace BLL
ProjectId = weldTask.ProjectId, ProjectId = weldTask.ProjectId,
// CusBillCode = string.Format("{0:yyyyMMdd}", DateTime.Now) + UnitService.GetUnitCodeByUnitId(weldTask.UnitId) + "-" + UnitWorkService.getUnitWorkByUnitWorkId(weldTask.UnitWorkId)?.UnitWorkCode + "AP-PF01", // 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 = BLL.Base_WarehouseService.GetWarehouseByWarehouseId(PipelineService.GetPipelineByPipelineId(weldTask.PipelineId).WarehouseId).WarehouseName, WarehouseId = taskWarehouse?.WarehouseId,
WarehouseCode = taskWarehouse?.WarehouseName,
Source = 1, Source = 1,
InOutType = (int)TwConst.InOutType., InOutType = (int)TwConst.InOutType.,
TypeInt = (int)TwConst.TypeInt., TypeInt = (int)TwConst.TypeInt.,
@@ -1088,7 +1123,8 @@ namespace BLL
Id = Guid.NewGuid().ToString(), Id = Guid.NewGuid().ToString(),
ProjectId = weldTask.ProjectId, ProjectId = weldTask.ProjectId,
CusBillCode = TwInOutplanmasterService.GetCusBillCodeByTaskCode(weldTaskCode, TwConst.TypeInt., TwConst.Category.), CusBillCode = TwInOutplanmasterService.GetCusBillCodeByTaskCode(weldTaskCode, TwConst.TypeInt., TwConst.Category.),
WarehouseCode = BLL.Base_WarehouseService.GetWarehouseByWarehouseId(PipelineService.GetPipelineByPipelineId(weldTask.PipelineId).WarehouseId).WarehouseName, WarehouseId = taskWarehouse?.WarehouseId,
WarehouseCode = taskWarehouse?.WarehouseName,
Source = 1, Source = 1,
InOutType = (int)TwConst.InOutType., InOutType = (int)TwConst.InOutType.,
TypeInt = (int)TwConst.TypeInt., TypeInt = (int)TwConst.TypeInt.,
+18 -6
View File
@@ -31,12 +31,15 @@ namespace BLL
from warehouseperson in warehousepersons.DefaultIfEmpty() from warehouseperson in warehousepersons.DefaultIfEmpty()
join unit in Funs.DB.Base_Unit on x.ReqUnitId equals unit.UnitId into units join unit in Funs.DB.Base_Unit on x.ReqUnitId equals unit.UnitId into units
from unit in units.DefaultIfEmpty() from unit in units.DefaultIfEmpty()
join warehouse in Funs.DB.Base_Warehouse on x.WarehouseId equals warehouse.WarehouseId into warehouses
from warehouse in warehouses.DefaultIfEmpty()
where where
(string.IsNullOrEmpty(table.Id) || x.Id.Contains(table.Id)) && (string.IsNullOrEmpty(table.Id) || x.Id.Contains(table.Id)) &&
(string.IsNullOrEmpty(table.InOutPlanMasterId) || x.InOutPlanMasterId.Contains(table.InOutPlanMasterId)) && (string.IsNullOrEmpty(table.InOutPlanMasterId) || x.InOutPlanMasterId.Contains(table.InOutPlanMasterId)) &&
(string.IsNullOrEmpty(table.ProjectId) || x.ProjectId.Contains(table.ProjectId)) && (string.IsNullOrEmpty(table.ProjectId) || x.ProjectId.Contains(table.ProjectId)) &&
(string.IsNullOrEmpty(table.CusBillCode) || x.CusBillCode.Contains(table.CusBillCode)) && (string.IsNullOrEmpty(table.CusBillCode) || x.CusBillCode.Contains(table.CusBillCode)) &&
(string.IsNullOrEmpty(table.WarehouseCode) || x.WarehouseCode.Contains(table.WarehouseCode)) && (string.IsNullOrEmpty(table.WarehouseId) || x.WarehouseId == table.WarehouseId) &&
(string.IsNullOrEmpty(table.WarehouseCode) || x.WarehouseCode.Contains(table.WarehouseCode) || x.WarehouseId.Contains(table.WarehouseCode)) &&
(string.IsNullOrEmpty(table.CreateMan) || x.CreateMan.Contains(table.CreateMan)) && (string.IsNullOrEmpty(table.CreateMan) || x.CreateMan.Contains(table.CreateMan)) &&
(string.IsNullOrEmpty(table.ReqUnitId) || x.ReqUnitId.Contains(table.ReqUnitId)) && (string.IsNullOrEmpty(table.ReqUnitId) || x.ReqUnitId.Contains(table.ReqUnitId)) &&
(table.TypeInt == null || x.TypeInt == table.TypeInt) && (table.TypeInt == null || x.TypeInt == table.TypeInt) &&
@@ -48,7 +51,9 @@ namespace BLL
ProjectId = x.ProjectId, ProjectId = x.ProjectId,
CusBillCode = x.CusBillCode, CusBillCode = x.CusBillCode,
InOutPlanMasterId = x.InOutPlanMasterId, InOutPlanMasterId = x.InOutPlanMasterId,
WarehouseCode = x.WarehouseCode, WarehouseId = x.WarehouseId,
WarehouseCode = warehouse == null ? x.WarehouseCode : warehouse.WarehouseName,
WarehouseName = warehouse == null ? x.WarehouseCode : warehouse.WarehouseName,
Source = x.Source, Source = x.Source,
Category = x.Category, Category = x.Category,
TypeInt = x.TypeInt, TypeInt = x.TypeInt,
@@ -93,7 +98,9 @@ namespace BLL
ProjectId = x.ProjectId, ProjectId = x.ProjectId,
CusBillCode = x.CusBillCode, CusBillCode = x.CusBillCode,
InOutPlanMasterId = x.InOutPlanMasterId, InOutPlanMasterId = x.InOutPlanMasterId,
WarehouseId = x.WarehouseId,
WarehouseCode = x.WarehouseCode, WarehouseCode = x.WarehouseCode,
WarehouseName = x.WarehouseName,
Source = x.Source, Source = x.Source,
TypeInt = x.TypeInt, TypeInt = x.TypeInt,
State = x.State, State = x.State,
@@ -133,7 +140,9 @@ namespace BLL
ProjectId = x.ProjectId, ProjectId = x.ProjectId,
CusBillCode = x.CusBillCode, CusBillCode = x.CusBillCode,
InOutPlanMasterId = x.InOutPlanMasterId, InOutPlanMasterId = x.InOutPlanMasterId,
WarehouseId = x.WarehouseId,
WarehouseCode = x.WarehouseCode, WarehouseCode = x.WarehouseCode,
WarehouseName = x.WarehouseName,
Source = x.Source, Source = x.Source,
TypeInt = x.TypeInt, TypeInt = x.TypeInt,
State = x.State, State = x.State,
@@ -172,7 +181,8 @@ namespace BLL
ProjectId = newtable.ProjectId, ProjectId = newtable.ProjectId,
InOutPlanMasterId = newtable.InOutPlanMasterId, InOutPlanMasterId = newtable.InOutPlanMasterId,
CusBillCode = newtable.CusBillCode, CusBillCode = newtable.CusBillCode,
WarehouseCode = newtable.WarehouseCode, WarehouseId = newtable.WarehouseId,
WarehouseCode = Base_WarehouseService.GetWarehouseNameById(newtable.WarehouseId) ?? newtable.WarehouseCode,
Category = newtable.Category, Category = newtable.Category,
Source = newtable.Source, Source = newtable.Source,
TypeInt = newtable.TypeInt, TypeInt = newtable.TypeInt,
@@ -200,7 +210,8 @@ namespace BLL
table.ProjectId = newtable.ProjectId; table.ProjectId = newtable.ProjectId;
table.InOutPlanMasterId = newtable.InOutPlanMasterId; table.InOutPlanMasterId = newtable.InOutPlanMasterId;
table.CusBillCode = newtable.CusBillCode; table.CusBillCode = newtable.CusBillCode;
table.WarehouseCode = newtable.WarehouseCode; table.WarehouseId = newtable.WarehouseId;
table.WarehouseCode = Base_WarehouseService.GetWarehouseNameById(newtable.WarehouseId) ?? newtable.WarehouseCode;
table.Category = newtable.Category; table.Category = newtable.Category;
table.Source = newtable.Source; table.Source = newtable.Source;
table.TypeInt = newtable.TypeInt; table.TypeInt = newtable.TypeInt;
@@ -258,6 +269,7 @@ namespace BLL
Id = Guid.NewGuid().ToString(), Id = Guid.NewGuid().ToString(),
InOutPlanMasterId = plan.Id, InOutPlanMasterId = plan.Id,
ProjectId = plan.ProjectId, ProjectId = plan.ProjectId,
WarehouseId = plan.WarehouseId,
WarehouseCode = plan.WarehouseCode, WarehouseCode = plan.WarehouseCode,
Source = plan.Source, Source = plan.Source,
TypeInt = plan.TypeInt, TypeInt = plan.TypeInt,
@@ -289,7 +301,7 @@ namespace BLL
}; };
TwInputdetailService.Add(detailTable); TwInputdetailService.Add(detailTable);
TwInputdetailBarCodeService.AddByInputDetail(master, detailTable); TwInputdetailBarCodeService.AddByInputDetail(master, detailTable);
TwMaterialstockService.UpdateStockNum(master.ProjectId, detail.MaterialCode, master.WarehouseCode, TwConst.InOutType., detailTable.ActNum); TwMaterialstockService.UpdateStockNum(master.ProjectId, detail.MaterialCode, master.WarehouseId, TwConst.InOutType., detailTable.ActNum);
} }
var planTable = TwInOutplanmasterService.GetById(plan.Id); var planTable = TwInOutplanmasterService.GetById(plan.Id);
@@ -330,7 +342,7 @@ namespace BLL
{ {
TwInputdetailService.DeleteById(detail.Id); TwInputdetailService.DeleteById(detail.Id);
//撤销入库,即减去库存 //撤销入库,即减去库存
TwMaterialstockService.UpdateStockNum(master.ProjectId, detail.MaterialCode, master.WarehouseCode, TwConst.InOutType., detail.ActNum); TwMaterialstockService.UpdateStockNum(master.ProjectId, detail.MaterialCode, master.WarehouseId, TwConst.InOutType., detail.ActNum);
} }
plan.State = (int)TwConst.State.; plan.State = (int)TwConst.State.;
TwInOutplanmasterService.Update(plan); TwInOutplanmasterService.Update(plan);
+17 -9
View File
@@ -29,16 +29,21 @@ namespace BLL
var q = from x in db.Tw_MaterialStock var q = from x in db.Tw_MaterialStock
join mat in db.HJGL_MaterialCodeLib on x.PipeLineMatCode equals mat.MaterialCode into mm join mat in db.HJGL_MaterialCodeLib on x.PipeLineMatCode equals mat.MaterialCode into mm
from mat in mm.DefaultIfEmpty() from mat in mm.DefaultIfEmpty()
join warehouse in db.Base_Warehouse on x.WarehouseId equals warehouse.WarehouseId into warehouses
from warehouse in warehouses.DefaultIfEmpty()
where where
(string.IsNullOrEmpty(table.Id) || x.Id.Contains(table.Id)) && (string.IsNullOrEmpty(table.Id) || x.Id.Contains(table.Id)) &&
(string.IsNullOrEmpty(table.WarehouseCode) || x.WarehouseCode.Contains(table.WarehouseCode)) && (string.IsNullOrEmpty(table.WarehouseId) || x.WarehouseId == table.WarehouseId) &&
(string.IsNullOrEmpty(table.WarehouseCode) || x.WarehouseCode.Contains(table.WarehouseCode) || x.WarehouseId.Contains(table.WarehouseCode)) &&
(string.IsNullOrEmpty(table.PipeLineMatCode) || x.PipeLineMatCode.Contains(table.PipeLineMatCode)) && (string.IsNullOrEmpty(table.PipeLineMatCode) || x.PipeLineMatCode.Contains(table.PipeLineMatCode)) &&
(string.IsNullOrEmpty(table.MaterialUnit) || mat.MaterialUnit.Contains(table.MaterialUnit)) && (string.IsNullOrEmpty(table.MaterialUnit) || mat.MaterialUnit.Contains(table.MaterialUnit)) &&
(string.IsNullOrEmpty(table.ProjectId) || x.ProjectId.Contains(table.ProjectId)) (string.IsNullOrEmpty(table.ProjectId) || x.ProjectId.Contains(table.ProjectId))
select new Model.Tw_MaterialStockOutput select new Model.Tw_MaterialStockOutput
{ {
Id = x.Id, Id = x.Id,
WarehouseCode = x.WarehouseCode, WarehouseId = x.WarehouseId,
WarehouseCode = warehouse == null ? x.WarehouseCode : warehouse.WarehouseName,
WarehouseName = warehouse == null ? x.WarehouseCode : warehouse.WarehouseName,
PipeLineMatCode = x.PipeLineMatCode, PipeLineMatCode = x.PipeLineMatCode,
StockNum = x.StockNum, StockNum = x.StockNum,
ProjectId = x.ProjectId, ProjectId = x.ProjectId,
@@ -88,7 +93,8 @@ namespace BLL
Model.Tw_MaterialStock table = new Model.Tw_MaterialStock Model.Tw_MaterialStock table = new Model.Tw_MaterialStock
{ {
Id = newtable.Id, Id = newtable.Id,
WarehouseCode = newtable.WarehouseCode, WarehouseId = newtable.WarehouseId,
WarehouseCode = Base_WarehouseService.GetWarehouseNameById(newtable.WarehouseId) ?? newtable.WarehouseCode,
PipeLineMatCode = newtable.PipeLineMatCode, PipeLineMatCode = newtable.PipeLineMatCode,
StockNum = newtable.StockNum, StockNum = newtable.StockNum,
ProjectId = newtable.ProjectId, ProjectId = newtable.ProjectId,
@@ -104,7 +110,8 @@ namespace BLL
if (table != null) if (table != null)
{ {
table.Id = newtable.Id; table.Id = newtable.Id;
table.WarehouseCode = newtable.WarehouseCode; table.WarehouseId = newtable.WarehouseId;
table.WarehouseCode = Base_WarehouseService.GetWarehouseNameById(newtable.WarehouseId) ?? newtable.WarehouseCode;
table.PipeLineMatCode = newtable.PipeLineMatCode; table.PipeLineMatCode = newtable.PipeLineMatCode;
table.StockNum = newtable.StockNum; table.StockNum = newtable.StockNum;
table.ProjectId = newtable.ProjectId; table.ProjectId = newtable.ProjectId;
@@ -125,16 +132,16 @@ namespace BLL
} }
/// <summary> /// <summary>
/// 根据项目编码,材料编码,仓库编码,数量增减库存 /// 根据项目编码,材料编码,仓库主键,数量增减库存
/// </summary> /// </summary>
/// <param name="ProjectId"></param> /// <param name="ProjectId"></param>
/// <param name="MaterialCode"></param> /// <param name="MaterialCode"></param>
/// <param name="WarehouseCode"></param> /// <param name="warehouseId"></param>
/// <param name="inOutType"></param> /// <param name="inOutType"></param>
/// <param name="StockNum"></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 warehouseId, TwConst.InOutType inOutType, decimal? StockNum)
{ {
Model.Tw_MaterialStock table = Funs.DB.Tw_MaterialStock.FirstOrDefault(x => x.ProjectId == ProjectId && x.PipeLineMatCode == MaterialCode && x.WarehouseCode == WarehouseCode); Model.Tw_MaterialStock table = Funs.DB.Tw_MaterialStock.FirstOrDefault(x => x.ProjectId == ProjectId && x.PipeLineMatCode == MaterialCode && x.WarehouseId == warehouseId);
//如果是入库,则库存数量加上,如果是出库,则库存数量减去 //如果是入库,则库存数量加上,如果是出库,则库存数量减去
if (inOutType == TwConst.InOutType.) if (inOutType == TwConst.InOutType.)
{ {
@@ -153,7 +160,8 @@ namespace BLL
Id = Guid.NewGuid().ToString(), Id = Guid.NewGuid().ToString(),
ProjectId = ProjectId, ProjectId = ProjectId,
PipeLineMatCode = MaterialCode, PipeLineMatCode = MaterialCode,
WarehouseCode = WarehouseCode, WarehouseId = warehouseId,
WarehouseCode = Base_WarehouseService.GetWarehouseNameById(warehouseId),
StockNum = StockNum ?? 0, StockNum = StockNum ?? 0,
}; };
Funs.DB.Tw_MaterialStock.InsertOnSubmit(newtable); Funs.DB.Tw_MaterialStock.InsertOnSubmit(newtable);
+1 -1
View File
@@ -28,7 +28,7 @@ namespace BLL
from mat in mm.DefaultIfEmpty() from mat in mm.DefaultIfEmpty()
join master in Funs.DB.Tw_OutputMaster on x.OutputMasterId equals master.Id into masters join master in Funs.DB.Tw_OutputMaster on x.OutputMasterId equals master.Id into masters
from master in masters.DefaultIfEmpty() 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.WarehouseId, master.ProjectId } equals new { MaterialCode = stock.PipeLineMatCode, stock.WarehouseId, stock.ProjectId } into st
from stock in st.DefaultIfEmpty() from stock in st.DefaultIfEmpty()
where where
(string.IsNullOrEmpty(table.Id) || x.Id.Contains(table.Id)) && (string.IsNullOrEmpty(table.Id) || x.Id.Contains(table.Id)) &&
+18 -6
View File
@@ -39,12 +39,15 @@ namespace BLL
from warehouseperson in warehousepersons.DefaultIfEmpty() from warehouseperson in warehousepersons.DefaultIfEmpty()
join unit in Funs.DB.Base_Unit on x.ReqUnitId equals unit.UnitId into units join unit in Funs.DB.Base_Unit on x.ReqUnitId equals unit.UnitId into units
from unit in units.DefaultIfEmpty() from unit in units.DefaultIfEmpty()
join warehouse in Funs.DB.Base_Warehouse on x.WarehouseId equals warehouse.WarehouseId into warehouses
from warehouse in warehouses.DefaultIfEmpty()
where where
(string.IsNullOrEmpty(table.Id) || x.Id.Contains(table.Id)) && (string.IsNullOrEmpty(table.Id) || x.Id.Contains(table.Id)) &&
(string.IsNullOrEmpty(table.InOutPlanMasterId) || x.InOutPlanMasterId.Contains(table.InOutPlanMasterId)) && (string.IsNullOrEmpty(table.InOutPlanMasterId) || x.InOutPlanMasterId.Contains(table.InOutPlanMasterId)) &&
(string.IsNullOrEmpty(table.ProjectId) || x.ProjectId.Contains(table.ProjectId)) && (string.IsNullOrEmpty(table.ProjectId) || x.ProjectId.Contains(table.ProjectId)) &&
(string.IsNullOrEmpty(table.CusBillCode) || x.CusBillCode.Contains(table.CusBillCode)) && (string.IsNullOrEmpty(table.CusBillCode) || x.CusBillCode.Contains(table.CusBillCode)) &&
(string.IsNullOrEmpty(table.WarehouseCode) || x.WarehouseCode.Contains(table.WarehouseCode)) && (string.IsNullOrEmpty(table.WarehouseId) || x.WarehouseId == table.WarehouseId) &&
(string.IsNullOrEmpty(table.WarehouseCode) || x.WarehouseCode.Contains(table.WarehouseCode) || x.WarehouseId.Contains(table.WarehouseCode)) &&
(string.IsNullOrEmpty(table.CreateMan) || x.CreateMan.Contains(table.CreateMan)) && (string.IsNullOrEmpty(table.CreateMan) || x.CreateMan.Contains(table.CreateMan)) &&
(string.IsNullOrEmpty(table.ReqUnitId) || x.ReqUnitId.Contains(table.ReqUnitId)) && (string.IsNullOrEmpty(table.ReqUnitId) || x.ReqUnitId.Contains(table.ReqUnitId)) &&
(string.IsNullOrEmpty(table.UnitWorkId) || y.WeldTaskId.Contains(table.UnitWorkId)) && (string.IsNullOrEmpty(table.UnitWorkId) || y.WeldTaskId.Contains(table.UnitWorkId)) &&
@@ -58,7 +61,9 @@ namespace BLL
ProjectId = x.ProjectId, ProjectId = x.ProjectId,
CusBillCode = x.CusBillCode, CusBillCode = x.CusBillCode,
InOutPlanMasterId = x.InOutPlanMasterId, InOutPlanMasterId = x.InOutPlanMasterId,
WarehouseCode = x.WarehouseCode, WarehouseId = x.WarehouseId,
WarehouseCode = warehouse == null ? x.WarehouseCode : warehouse.WarehouseName,
WarehouseName = warehouse == null ? x.WarehouseCode : warehouse.WarehouseName,
Category = x.Category, Category = x.Category,
Source = x.Source, Source = x.Source,
TypeInt = x.TypeInt, TypeInt = x.TypeInt,
@@ -105,7 +110,9 @@ namespace BLL
Id = x.Id, Id = x.Id,
ProjectId = x.ProjectId, ProjectId = x.ProjectId,
CusBillCode = x.CusBillCode, CusBillCode = x.CusBillCode,
WarehouseId = x.WarehouseId,
WarehouseCode = x.WarehouseCode, WarehouseCode = x.WarehouseCode,
WarehouseName = x.WarehouseName,
InOutPlanMasterId = x.InOutPlanMasterId, InOutPlanMasterId = x.InOutPlanMasterId,
Source = x.Source, Source = x.Source,
TypeInt = x.TypeInt, TypeInt = x.TypeInt,
@@ -152,7 +159,9 @@ namespace BLL
ProjectId = x.ProjectId, ProjectId = x.ProjectId,
CusBillCode = x.CusBillCode, CusBillCode = x.CusBillCode,
InOutPlanMasterId = x.InOutPlanMasterId, InOutPlanMasterId = x.InOutPlanMasterId,
WarehouseId = x.WarehouseId,
WarehouseCode = x.WarehouseCode, WarehouseCode = x.WarehouseCode,
WarehouseName = x.WarehouseName,
Source = x.Source, Source = x.Source,
TypeInt = x.TypeInt, TypeInt = x.TypeInt,
State = x.State, State = x.State,
@@ -197,7 +206,8 @@ namespace BLL
ProjectId = newtable.ProjectId, ProjectId = newtable.ProjectId,
InOutPlanMasterId = newtable.InOutPlanMasterId, InOutPlanMasterId = newtable.InOutPlanMasterId,
CusBillCode = newtable.CusBillCode, CusBillCode = newtable.CusBillCode,
WarehouseCode = newtable.WarehouseCode, WarehouseId = newtable.WarehouseId,
WarehouseCode = Base_WarehouseService.GetWarehouseNameById(newtable.WarehouseId) ?? newtable.WarehouseCode,
Category = newtable.Category, Category = newtable.Category,
Source = newtable.Source, Source = newtable.Source,
TypeInt = newtable.TypeInt, TypeInt = newtable.TypeInt,
@@ -226,7 +236,8 @@ namespace BLL
table.ProjectId = newtable.ProjectId; table.ProjectId = newtable.ProjectId;
table.InOutPlanMasterId = newtable.InOutPlanMasterId; table.InOutPlanMasterId = newtable.InOutPlanMasterId;
table.CusBillCode = newtable.CusBillCode; table.CusBillCode = newtable.CusBillCode;
table.WarehouseCode = newtable.WarehouseCode; table.WarehouseId = newtable.WarehouseId;
table.WarehouseCode = Base_WarehouseService.GetWarehouseNameById(newtable.WarehouseId) ?? newtable.WarehouseCode;
table.Category = newtable.Category; table.Category = newtable.Category;
table.Source = newtable.Source; table.Source = newtable.Source;
table.TypeInt = newtable.TypeInt; table.TypeInt = newtable.TypeInt;
@@ -285,6 +296,7 @@ namespace BLL
InOutPlanMasterId = plan.Id, InOutPlanMasterId = plan.Id,
ProjectId = plan.ProjectId, 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),
WarehouseId = plan.WarehouseId,
WarehouseCode = plan.WarehouseCode, WarehouseCode = plan.WarehouseCode,
Category = plan.Category, Category = plan.Category,
Source = plan.Source, Source = plan.Source,
@@ -314,7 +326,7 @@ namespace BLL
ActNum = detail.ActNum, ActNum = detail.ActNum,
}; };
TwOutputdetailService.Add(detailTable); TwOutputdetailService.Add(detailTable);
TwMaterialstockService.UpdateStockNum(master.ProjectId, detail.MaterialCode, master.WarehouseCode, TwConst.InOutType., detailTable.ActNum); TwMaterialstockService.UpdateStockNum(master.ProjectId, detail.MaterialCode, master.WarehouseId, TwConst.InOutType., detailTable.ActNum);
} }
plan.State = (int)TwConst.State.; plan.State = (int)TwConst.State.;
@@ -344,7 +356,7 @@ namespace BLL
{ {
TwOutputdetailService.DeleteById(detail.Id); TwOutputdetailService.DeleteById(detail.Id);
//撤销出库,即增加库存 //撤销出库,即增加库存
TwMaterialstockService.UpdateStockNum(master.ProjectId, detail.MaterialCode, master.WarehouseCode, TwConst.InOutType., detail.ActNum); TwMaterialstockService.UpdateStockNum(master.ProjectId, detail.MaterialCode, master.WarehouseId, TwConst.InOutType., detail.ActNum);
} }
var planModel = TwInOutplanmasterService.GetById(planId); var planModel = TwInOutplanmasterService.GetById(planId);
planModel.State = (int)TwConst.State.; planModel.State = (int)TwConst.State.;
@@ -16,6 +16,22 @@ namespace BLL
return Funs.DB.Base_Warehouse.FirstOrDefault(e => e.WarehouseId == warehouseId); return Funs.DB.Base_Warehouse.FirstOrDefault(e => e.WarehouseId == warehouseId);
} }
/// <summary>
/// 根据项目和仓库名称获取仓库信息,主要用于历史名称数据迁移和导入校验。
/// </summary>
public static Model.Base_Warehouse GetWarehouseByName(string projectId, string warehouseName)
{
return Funs.DB.Base_Warehouse.FirstOrDefault(e => e.ProjectId == projectId && e.WarehouseName == warehouseName);
}
/// <summary>
/// 获取仓库显示名称,材料业务保存主键后仍用名称做列表显示。
/// </summary>
public static string GetWarehouseNameById(string warehouseId)
{
return Funs.DB.Base_Warehouse.Where(e => e.WarehouseId == warehouseId).Select(e => e.WarehouseName).FirstOrDefault();
}
/// <summary> /// <summary>
/// 新增仓库信息 /// 新增仓库信息
/// </summary> /// </summary>
+1 -1
View File
@@ -58,7 +58,7 @@ namespace FineUIPro.Web.CLGL
} }
if (drpWarehouse.SelectedValue != Const._Null) if (drpWarehouse.SelectedValue != Const._Null)
{ {
table.WarehouseCode = drpWarehouse.SelectedValue; table.WarehouseId = drpWarehouse.SelectedValue;
} }
var tb = BLL.TwInOutplanmasterService.GetListData(table, Grid1); var tb = BLL.TwInOutplanmasterService.GetListData(table, Grid1);
Grid1.RecordCount = TwInOutplanmasterService.Count; Grid1.RecordCount = TwInOutplanmasterService.Count;
+1 -1
View File
@@ -55,7 +55,7 @@ namespace FineUIPro.Web.CLGL
} }
if (drpWarehouse.SelectedValue != Const._Null) if (drpWarehouse.SelectedValue != Const._Null)
{ {
table.WarehouseCode = drpWarehouse.SelectedValue; table.WarehouseId = drpWarehouse.SelectedValue;
} }
var tb = BLL.TwInputmasterService.GetListData(table, Grid1); var tb = BLL.TwInputmasterService.GetListData(table, Grid1);
Grid1.RecordCount = TwInputmasterService.Count; Grid1.RecordCount = TwInputmasterService.Count;
@@ -32,7 +32,7 @@ namespace FineUIPro.Web.CLGL
table.PipeLineMatCode = txtMatCode.Text.Trim(); table.PipeLineMatCode = txtMatCode.Text.Trim();
if (drpWarehouse.SelectedValue != Const._Null) if (drpWarehouse.SelectedValue != Const._Null)
{ {
table.WarehouseCode = drpWarehouse.SelectedValue; table.WarehouseId = drpWarehouse.SelectedValue;
} }
table.ProjectId = this.CurrUser.LoginProjectId; table.ProjectId = this.CurrUser.LoginProjectId;
var tb = BLL.TwMaterialstockService.GetListData(table, Grid1); var tb = BLL.TwMaterialstockService.GetListData(table, Grid1);
@@ -73,7 +73,7 @@ namespace FineUIPro.Web.CLGL
} }
if (drpWarehouse.SelectedValue != Const._Null) if (drpWarehouse.SelectedValue != Const._Null)
{ {
table.WarehouseCode = drpWarehouse.SelectedValue; table.WarehouseId = drpWarehouse.SelectedValue;
} }
if (!string.IsNullOrEmpty(tvControlItem.SelectedNodeID)) if (!string.IsNullOrEmpty(tvControlItem.SelectedNodeID))
{ {
@@ -328,7 +328,7 @@ namespace FineUIPro.Web.CLGL
private List<Tw_MaterialStockOutput> GetSelectableStockList(Tw_InOutPlanMaster master) private List<Tw_MaterialStockOutput> GetSelectableStockList(Tw_InOutPlanMaster master)
{ {
Tw_MaterialStockOutput stockQuery = new Tw_MaterialStockOutput(); Tw_MaterialStockOutput stockQuery = new Tw_MaterialStockOutput();
stockQuery.WarehouseCode = master.WarehouseCode; stockQuery.WarehouseId = master.WarehouseId;
stockQuery.ProjectId = CurrUser.LoginProjectId; stockQuery.ProjectId = CurrUser.LoginProjectId;
stockQuery.MaterialUnit = GetRequiredMaterialUnit(master.Category); stockQuery.MaterialUnit = GetRequiredMaterialUnit(master.Category);
return TwMaterialstockService.GetTw_MaterialStockByModle(stockQuery); return TwMaterialstockService.GetTw_MaterialStockByModle(stockQuery);
@@ -62,7 +62,7 @@ namespace FineUIPro.Web.CLGL
txtCreateDate.Text = result.CreateDate.Value.ToString("yyyy-MM-dd"); txtCreateDate.Text = result.CreateDate.Value.ToString("yyyy-MM-dd");
drpReqUnit.SelectedValue = result.ReqUnitId; drpReqUnit.SelectedValue = result.ReqUnitId;
drpTypeInt.SelectedValue = result.TypeInt.ToString(); drpTypeInt.SelectedValue = result.TypeInt.ToString();
drpWarehouse.SelectedValue = result.WarehouseCode; drpWarehouse.SelectedValue = result.WarehouseId;
drpCategory.SelectedValue = result.Category.ToString(); drpCategory.SelectedValue = result.Category.ToString();
txtRemark.Text = result.Remark; txtRemark.Text = result.Remark;
txtCusBillCode.Text = result.CusBillCode; txtCusBillCode.Text = result.CusBillCode;
@@ -184,7 +184,8 @@ namespace FineUIPro.Web.CLGL
Id = Id, Id = Id,
ProjectId = this.CurrUser.LoginProjectId, ProjectId = this.CurrUser.LoginProjectId,
CusBillCode = txtCusBillCode.Text, CusBillCode = txtCusBillCode.Text,
WarehouseCode = drpWarehouse.SelectedValue, WarehouseId = drpWarehouse.SelectedValue,
WarehouseCode = drpWarehouse.SelectedText,
WeldTaskId = UnitWorkId, WeldTaskId = UnitWorkId,
Source = 1, Source = 1,
CreateDate = DateTime.Now, CreateDate = DateTime.Now,
@@ -202,7 +203,8 @@ namespace FineUIPro.Web.CLGL
{ {
var model = TwInOutplanmasterService.GetById(Id); var model = TwInOutplanmasterService.GetById(Id);
model.CusBillCode = txtCusBillCode.Text; model.CusBillCode = txtCusBillCode.Text;
model.WarehouseCode = drpWarehouse.SelectedValue; model.WarehouseId = drpWarehouse.SelectedValue;
model.WarehouseCode = drpWarehouse.SelectedText;
// model.WeldTaskId = UnitWorkId; // model.WeldTaskId = UnitWorkId;
model.Source = 1; model.Source = 1;
model.CreateDate = DateTime.Now; model.CreateDate = DateTime.Now;
@@ -42,7 +42,7 @@ namespace FineUIPro.Web.CLGL
Model.Tw_MaterialStockOutput table = new Model.Tw_MaterialStockOutput(); Model.Tw_MaterialStockOutput table = new Model.Tw_MaterialStockOutput();
table.PipeLineMatCode = txtMatCode.Text.Trim(); table.PipeLineMatCode = txtMatCode.Text.Trim();
table.WarehouseCode = inoutplanmaster.WarehouseCode; table.WarehouseId = inoutplanmaster.WarehouseId;
table.ProjectId = this.CurrUser.LoginProjectId; table.ProjectId = this.CurrUser.LoginProjectId;
if (inoutplanmaster.Category == (int)TwConst.Category.) if (inoutplanmaster.Category == (int)TwConst.Category.)
{ {
+1 -1
View File
@@ -77,7 +77,7 @@ namespace FineUIPro.Web.CLGL
} }
if (drpWarehouse.SelectedValue != Const._Null) if (drpWarehouse.SelectedValue != Const._Null)
{ {
table.WarehouseCode = drpWarehouse.SelectedValue; table.WarehouseId = drpWarehouse.SelectedValue;
} }
if (!string.IsNullOrEmpty(tvControlItem.SelectedNodeID)) if (!string.IsNullOrEmpty(tvControlItem.SelectedNodeID))
@@ -312,7 +312,7 @@ namespace FineUIPro.Web.HJGL.WeldingManage
{ {
var completeInOutPlanDetailRelationList = from x in Funs.DB.Tw_InOutPlanDetail_Relation var completeInOutPlanDetailRelationList = 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 y.State == (int)TwConst.State. && y.WarehouseCode == drpWarehouse.SelectedValue where y.State == (int)TwConst.State. && y.WarehouseId == drpWarehouse.SelectedValue
select x; select x;
var pipeline = (from x in Funs.DB.HJGL_Pipeline var pipeline = (from x in Funs.DB.HJGL_Pipeline
@@ -1083,7 +1083,10 @@ namespace FineUIPro.Web.HJGL.WeldingManage
protected void drpWarehouse_SelectedIndexChanged(object sender, EventArgs e) protected void drpWarehouse_SelectedIndexChanged(object sender, EventArgs e)
{ {
WarehouseId = Base_WarehouseService.GetWarehouseList(this.CurrUser.LoginProjectId).Where(x => x.WarehouseName == drpWarehouse.SelectedValue).Select(x => x.WarehouseId).FirstOrDefault(); WarehouseId = Base_WarehouseService.GetWarehouseList(this.CurrUser.LoginProjectId)
.Where(x => x.WarehouseId == drpWarehouse.SelectedValue || x.WarehouseName == drpWarehouse.SelectedValue)
.Select(x => x.WarehouseId)
.FirstOrDefault();
this.InitTreeMenu();//加载树 this.InitTreeMenu();//加载树
} }
} }
@@ -6,7 +6,7 @@
<html xmlns="http://www.w3.org/1999/xhtml"> <html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server"> <head runat="server">
<title>焊接日报</title> <title>焊接日报</title>
<meta name="sourcefiles" content="~/HJGL/WeldingManage/GetWdldingDailyItem.ashx"/> <meta name="sourcefiles" content="~/HJGL/WeldingManage/GetWdldingDailyItem.ashx" />
<link href="../../res/css/viewer.min.css" rel="stylesheet" /> <link href="../../res/css/viewer.min.css" rel="stylesheet" />
<script src="../../res/js/viewer.min.js" type="text/javascript"></script> <script src="../../res/js/viewer.min.js" type="text/javascript"></script>
<style type="text/css"> <style type="text/css">
@@ -35,8 +35,8 @@
</style> </style>
</head> </head>
<body> <body>
<form id="form1" runat="server"> <form id="form1" runat="server">
<f:PageManager ID="PageManager1" AutoSizePanelID="Panel1" runat="server"/> <f:PageManager ID="PageManager1" AutoSizePanelID="Panel1" runat="server" />
<f:Panel ID="Panel1" runat="server" ShowBorder="false" ShowHeader="false" Layout="Region"> <f:Panel ID="Panel1" runat="server" ShowBorder="false" ShowHeader="false" Layout="Region">
<Items> <Items>
<f:Panel runat="server" ID="panelLeftRegion" RegionPosition="Left" RegionSplit="true" <f:Panel runat="server" ID="panelLeftRegion" RegionPosition="Left" RegionSplit="true"
@@ -58,7 +58,7 @@
EnableSingleClickExpand="true" AutoLeafIdentification="true" EnableSingleExpand="true" EnableSingleClickExpand="true" AutoLeafIdentification="true" EnableSingleExpand="true"
EnableTextSelection="true"> EnableTextSelection="true">
<Listeners> <Listeners>
<f:Listener Event="beforenodecontextmenu" Handler="onTreeNodeContextMenu"/> <f:Listener Event="beforenodecontextmenu" Handler="onTreeNodeContextMenu" />
</Listeners> </Listeners>
</f:Tree> </f:Tree>
</Items> </Items>
@@ -126,7 +126,7 @@
</Toolbars> </Toolbars>
<Columns> <Columns>
<f:RowNumberField EnablePagingNumber="true" HeaderText="序号" <f:RowNumberField EnablePagingNumber="true" HeaderText="序号"
Width="50px" HeaderTextAlign="Center" TextAlign="Center"/> Width="50px" HeaderTextAlign="Center" TextAlign="Center" />
<f:RenderField HeaderText="管线号" ColumnID="PipelineCode" <f:RenderField HeaderText="管线号" ColumnID="PipelineCode"
DataField="PipelineCode" FieldType="String" HeaderTextAlign="Center" DataField="PipelineCode" FieldType="String" HeaderTextAlign="Center"
TextAlign="Left" Width="180px"> TextAlign="Left" Width="180px">
@@ -226,10 +226,10 @@
</f:ToolbarText> </f:ToolbarText>
<f:DropDownList runat="server" ID="ddlPageSize" Width="80px" AutoPostBack="true" <f:DropDownList runat="server" ID="ddlPageSize" Width="80px" AutoPostBack="true"
OnSelectedIndexChanged="ddlPageSize_SelectedIndexChanged"> OnSelectedIndexChanged="ddlPageSize_SelectedIndexChanged">
<f:ListItem Text="15" Value="15"/> <f:ListItem Text="15" Value="15" />
<f:ListItem Text="25" Value="25"/> <f:ListItem Text="25" Value="25" />
<f:ListItem Text="50" Value="50"/> <f:ListItem Text="50" Value="50" />
<f:ListItem Text="100" Value="100"/> <f:ListItem Text="100" Value="100" />
</f:DropDownList> </f:DropDownList>
</PageItems> </PageItems>
</f:Grid> </f:Grid>
@@ -263,7 +263,7 @@
</f:Toolbar> </f:Toolbar>
</Toolbars> </Toolbars>
<Columns> <Columns>
<f:RowNumberField EnablePagingNumber="true" HeaderText="序号" Width="50px" HeaderTextAlign="Center" TextAlign="Center"/> <f:RowNumberField EnablePagingNumber="true" HeaderText="序号" Width="50px" HeaderTextAlign="Center" TextAlign="Center" />
<f:RenderField HeaderText="管线号" ColumnID="PipelineCode" DataField="PipelineCode" FieldType="String" <f:RenderField HeaderText="管线号" ColumnID="PipelineCode" DataField="PipelineCode" FieldType="String"
HeaderTextAlign="Center" TextAlign="Left" Width="180px"> HeaderTextAlign="Center" TextAlign="Left" Width="180px">
</f:RenderField> </f:RenderField>
@@ -323,10 +323,10 @@
</f:ToolbarText> </f:ToolbarText>
<f:DropDownList runat="server" ID="ddlPendingPageSize" Width="80px" AutoPostBack="true" <f:DropDownList runat="server" ID="ddlPendingPageSize" Width="80px" AutoPostBack="true"
OnSelectedIndexChanged="ddlPendingPageSize_SelectedIndexChanged"> OnSelectedIndexChanged="ddlPendingPageSize_SelectedIndexChanged">
<f:ListItem Text="10" Value="10"/> <f:ListItem Text="10" Value="10" />
<f:ListItem Text="30" Value="30"/> <f:ListItem Text="30" Value="30" />
<f:ListItem Text="50" Value="50"/> <f:ListItem Text="50" Value="50" />
<f:ListItem Text="100" Value="100"/> <f:ListItem Text="100" Value="100" />
</f:DropDownList> </f:DropDownList>
</PageItems> </PageItems>
</f:Grid> </f:Grid>
@@ -364,8 +364,8 @@
EnablePostBack="true" Icon="Delete" ConfirmText="删除选中行?" ConfirmTarget="Top" runat="server" Text="删除" OnClick="btnMenuDeleteDetail_Click"> EnablePostBack="true" Icon="Delete" ConfirmText="删除选中行?" ConfirmTarget="Top" runat="server" Text="删除" OnClick="btnMenuDeleteDetail_Click">
</f:MenuButton> </f:MenuButton>
</f:Menu> </f:Menu>
</form> </form>
<script type="text/javascript"> <script type="text/javascript">
var menuID = '<%= Menu1.ClientID %>'; var menuID = '<%= Menu1.ClientID %>';
var menuID2 = '<%= Menu2.ClientID %>'; var menuID2 = '<%= Menu2.ClientID %>';
@@ -380,12 +380,12 @@
} }
function reloadGrid() { function reloadGrid() {
__doPostBack(null, 'reloadGrid'); __doPostBack(null, 'reloadGrid');
} }
var imgIDs = ['<%=Grid1.ClientID %>', '<%=GridPending.ClientID %>']; var imgIDs = ['<%=Grid1.ClientID %>', '<%=GridPending.ClientID %>'];
function showImg() { function showImg() {
$.each(imgIDs, function(_, imgID) { $.each(imgIDs, function (_, imgID) {
var $wrap = $("#" + imgID); var $wrap = $("#" + imgID);
$wrap.find('img').off('click.weldreport').on('click.weldreport', function() { $wrap.find('img').off('click.weldreport').on('click.weldreport', function () {
var src = $(this).attr('src'); var src = $(this).attr('src');
if (!src || src.indexOf("/res/icon") != -1) { if (!src || src.indexOf("/res/icon") != -1) {
return; return;
@@ -399,18 +399,18 @@ function showImg() {
viewer.show(); // 显示图片预览 viewer.show(); // 显示图片预览
// 在 Viewer 关闭后移除添加的 div 元素 // 在 Viewer 关闭后移除添加的 div 元素
viewer.on('hidden', function() { viewer.on('hidden', function () {
document.body.removeChild(div); document.body.removeChild(div);
}); });
}); });
}); });
$('.imgPreview').on('click', function() { $('.imgPreview').on('click', function () {
// $('.imgPreview').hide() // $('.imgPreview').hide()
}); });
} }
F.ready(function() { F.ready(function () {
showImg(); showImg();
}) })
</script> </script>
</body> </body>
</html> </html>
@@ -6,6 +6,7 @@ using System.Data;
using System.Data.SqlClient; using System.Data.SqlClient;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Web;
namespace FineUIPro.Web.HJGL.WeldingManage namespace FineUIPro.Web.HJGL.WeldingManage
{ {
@@ -402,13 +403,21 @@ namespace FineUIPro.Web.HJGL.WeldingManage
protected string ConvertImageUrlByImage(object photoUrl) protected string ConvertImageUrlByImage(object photoUrl)
{ {
string url = string.Empty; if (photoUrl == null || string.IsNullOrEmpty(photoUrl.ToString()))
if (photoUrl != null)
{ {
url = BLL.UploadAttachmentService.ShowImage("../../", photoUrl.ToString()); return string.Empty;
} }
return url;
string htmlStr = "<table runat='server' cellpadding='5' cellspacing='5' style=\"width: 100%\">";
foreach (string item in photoUrl.ToString().Split(new[] { "," }, StringSplitOptions.RemoveEmptyEntries))
{
string imageUrl = "../../" + item.Replace('\\', '/');
// 日报表格图片只用于本页放大预览,不包跳转链接,避免点击时打开新标签页。
htmlStr += "<tr><td style=\"width: 60%\" align=\"left\"><img class='img' width='100' height='100' src='"
+ HttpUtility.HtmlAttributeEncode(imageUrl) + "'></img></td></tr>";
}
htmlStr += "</table>";
return htmlStr;
} }
#region #region
+1
View File
@@ -14,6 +14,7 @@ namespace Model
public string TypeString { get; set; } public string TypeString { get; set; }
public string CreateManName { get; set; } public string CreateManName { get; set; }
public string WarehouseManName { get; set; } public string WarehouseManName { get; set; }
public string WarehouseName { get; set; }
public string AuditManName { get; set; } public string AuditManName { get; set; }
public string AuditManName2 { get; set; } public string AuditManName2 { get; set; }
public string ReqUnitName { get; set; } public string ReqUnitName { get; set; }
@@ -2,6 +2,7 @@
{ {
public class Tw_MaterialStockOutput: Tw_MaterialStock public class Tw_MaterialStockOutput: Tw_MaterialStock
{ {
public string WarehouseName { get; set; }
public string Code { get; set; } public string Code { get; set; }
public string HeatNo { get; set; } public string HeatNo { get; set; }
public string BatchNo { get; set; } public string BatchNo { get; set; }
@@ -6,6 +6,8 @@ namespace Model
{ {
public string WarehouseCode { get; set; } public string WarehouseCode { get; set; }
public string WarehouseId { get; set; }
public string MaterialCode { get; set; } public string MaterialCode { get; set; }
public string Code { get; set; } public string Code { get; set; }
@@ -0,0 +1,85 @@
using System;
using System.Data.Linq.Mapping;
namespace Model
{
public partial class Tw_InOutPlanMaster
{
private string _WarehouseId;
[Column(Storage = "_WarehouseId", DbType = "NVarChar(50)")]
public string WarehouseId
{
get { return this._WarehouseId; }
set
{
if (this._WarehouseId != value)
{
this.SendPropertyChanging();
this._WarehouseId = value;
this.SendPropertyChanged("WarehouseId");
}
}
}
}
public partial class Tw_InputMaster
{
private string _WarehouseId;
[Column(Storage = "_WarehouseId", DbType = "NVarChar(50)")]
public string WarehouseId
{
get { return this._WarehouseId; }
set
{
if (this._WarehouseId != value)
{
this.SendPropertyChanging();
this._WarehouseId = value;
this.SendPropertyChanged("WarehouseId");
}
}
}
}
public partial class Tw_OutputMaster
{
private string _WarehouseId;
[Column(Storage = "_WarehouseId", DbType = "NVarChar(50)")]
public string WarehouseId
{
get { return this._WarehouseId; }
set
{
if (this._WarehouseId != value)
{
this.SendPropertyChanging();
this._WarehouseId = value;
this.SendPropertyChanged("WarehouseId");
}
}
}
}
public partial class Tw_MaterialStock
{
private string _WarehouseId;
[Column(Storage = "_WarehouseId", DbType = "NVarChar(50)")]
public string WarehouseId
{
get { return this._WarehouseId; }
set
{
if (this._WarehouseId != value)
{
this.SendPropertyChanging();
this._WarehouseId = value;
this.SendPropertyChanged("WarehouseId");
}
}
}
}
}
+1
View File
@@ -233,6 +233,7 @@
<Compile Include="CLGL\Tw_MaterialStockOutput.cs" /> <Compile Include="CLGL\Tw_MaterialStockOutput.cs" />
<Compile Include="CLGL\Tw_OutHistoryDataIn.cs" /> <Compile Include="CLGL\Tw_OutHistoryDataIn.cs" />
<Compile Include="CLGL\Tw_OutHistoryImportRow.cs" /> <Compile Include="CLGL\Tw_OutHistoryImportRow.cs" />
<Compile Include="CLGL\Tw_WarehouseIdExtensions.cs" />
<Compile Include="CLGL\Tw_PipeLineMat.cs" /> <Compile Include="CLGL\Tw_PipeLineMat.cs" />
<Compile Include="CLGL\AntiCorrosionTrustOutput.cs" /> <Compile Include="CLGL\AntiCorrosionTrustOutput.cs" />
<Compile Include="CLGL\AntiCorrosionTrustDetailOutput.cs" /> <Compile Include="CLGL\AntiCorrosionTrustDetailOutput.cs" />