仓库-出库单,出库记录,批量查看,成品库等功能优化调整,出库逻辑调整
This commit is contained in:
@@ -434,5 +434,97 @@ namespace ZR.Service.Business
|
||||
}
|
||||
}
|
||||
|
||||
public PagedInfo<WmGoodsBatchTableDto> GetBatchOutRecordByShipmentNum(WmGoodsBatchSearchDto parm)
|
||||
{
|
||||
try
|
||||
{
|
||||
// 查询条件
|
||||
var exp = Expressionable.Create<WmGoodsOutRecord>()
|
||||
.AndIF(!string.IsNullOrEmpty(parm.ShipmentNum), it => it.FkOutOrderId.Contains(parm.ShipmentNum))
|
||||
.And(it => it.FkOutOrderId != string.Empty)
|
||||
// 根据sql语句进行切换
|
||||
//.AndIF(!string.IsNullOrEmpty(parm.PackageCode), it => it.PackageCode.Contains(parm.PackageCode))
|
||||
.ToExpression();
|
||||
string sql = "SELECT\n" +
|
||||
" MAX( id ) AS ID,\n" +
|
||||
" MAX( fk_out_order_id ) AS fk_out_order_id,\n" +
|
||||
" IFNULL( fk_out_order_id, '无出库单' ) AS ShipmentNum,\n" +
|
||||
" IFNULL( fk_out_order_id, '无出库单' ) AS PackageCodeClient_son,\n" +
|
||||
" NULL AS PackageCodeClient_short_parent,\n" +
|
||||
" '' AS Partnumber,\n" +
|
||||
" '' AS Description,\n" +
|
||||
" '' AS PackageCode,\n" +
|
||||
" '' AS LocationCode,\n" +
|
||||
" COUNT( * ) AS PackageNum,\n" +
|
||||
" SUM( goods_num_logic ) AS GoodsNumLogic,\n" +
|
||||
" SUM( goods_num_action ) AS GoodsNumAction,\n" +
|
||||
" '' AS Remark,\n" +
|
||||
" NULL AS OutTime,\n" +
|
||||
" TRUE AS HasChild \n" +
|
||||
"FROM\n" +
|
||||
" wm_goods_out_record \n" +
|
||||
"GROUP BY\n" +
|
||||
" ShipmentNum \n" +
|
||||
"ORDER BY\n" +
|
||||
" ShipmentNum DESC";
|
||||
PagedInfo<WmGoodsBatchTableDto> result = Context.SqlQueryable<WmGoodsOutRecord>(sql)
|
||||
.Where(exp)
|
||||
.Select<WmGoodsBatchTableDto>()
|
||||
.ToPage(parm);
|
||||
return result;
|
||||
}
|
||||
catch
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public PagedInfo<WmGoodsBatchTableDto> GetBatchOutRecordTreeLazyByShipmentNum(WmGoodsBatchSearchDto parm)
|
||||
{
|
||||
try
|
||||
{
|
||||
PagedInfo<WmGoodsBatchTableDto> result = new PagedInfo<WmGoodsBatchTableDto>();
|
||||
// 出库记录
|
||||
List<WmGoodsBatchTableDto> list = Context.Queryable<WmGoodsOutRecord>()
|
||||
.Where(it => it.FkOutOrderId == parm.ShipmentNum)
|
||||
.Select(it => new WmGoodsBatchTableDto
|
||||
{
|
||||
Id = it.Id,
|
||||
ShipmentNum = it.FkOutOrderId,
|
||||
PackageCode = it.PackageCodeClient,
|
||||
PackageCodeClient_son = null,
|
||||
PackageCodeClient_short_parent = it.FkOutOrderId,
|
||||
Partnumber = it.Partnumber,
|
||||
Description = "",
|
||||
LocationCode = it.LocationCode,
|
||||
PackageNum = 1,
|
||||
GoodsNumLogic = (int)it.GoodsNumLogic,
|
||||
GoodsNumAction = (int)it.GoodsNumAction,
|
||||
OutTime = it.OutTime,
|
||||
Remark = it.Remark,
|
||||
HasChild = false
|
||||
})
|
||||
.OrderBy(it => it.Id)
|
||||
.ToList();
|
||||
foreach (WmGoodsBatchTableDto item in list)
|
||||
{
|
||||
WmMaterial material = Context.Queryable<WmMaterial>()
|
||||
.Where(it => it.Partnumber == item.Partnumber)
|
||||
.First();
|
||||
if (material == null)
|
||||
{
|
||||
item.Description = "此零件号不在物料清单内!";
|
||||
continue;
|
||||
}
|
||||
item.Description = !string.IsNullOrEmpty(material.Description) ? material.Description : material.ProductName;
|
||||
}
|
||||
result.Result = list;
|
||||
return result;
|
||||
}
|
||||
catch
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user