|
|
@@ -67,7 +67,7 @@ class InventoryAccountService
|
|
|
$sql='select * from (select result.*,rownum rn from (';
|
|
|
$sql.=' select customer.Descr_C as 货主,stockLog.客户 客户, 库位, sku.SKU 产品编码, sku.ALTERNATE_SKU1 产品条码1, sku.ALTERNATE_SKU2 产品条码2, sku.ALTERNATE_SKU3 产品条码3, ';
|
|
|
$sql.=' sku.Descr_C 商品名称, lot.LotAtt05 属性仓, lot.LotAtt08 质量状态, lot.LotAtt02 失效日期, ';
|
|
|
- $sql.=' lot.LotAtt04 批号, lot.LotAtt01 生产日期, lot.LotAtt03 入库日期';
|
|
|
+ $sql.=' lot.LotAtt04 批号, lot.LotAtt01 生产日期';
|
|
|
$sql.=' , sum(移出数量)移出数量, sum(移入数量)移入数量 ';
|
|
|
$sql.=' , storeStatus.QTY 在库数量, storeStatus.QtyAllocated 占用数量,count(1) over () as sum from ';
|
|
|
$sql.=' (select FMLotNum,FMSKU,TOCustomerID 客户,0 as 移出数量, sum(TOQty_Each) as 移入数量, TOLocation as 库位 ';
|
|
|
@@ -96,7 +96,7 @@ class InventoryAccountService
|
|
|
$sql.=' left join INV_LOT_LOC_ID storeStatus on storeStatus.LOTNUM=stockLog.FMLOTNUM ';;
|
|
|
$sql.=' and storeStatus.LocationID=stockLog.库位 ';
|
|
|
$sql.=' group by 库位,customer.Descr_C,sku.SKU,sku.ALTERNATE_SKU1,sku.ALTERNATE_SKU2,sku.ALTERNATE_SKU3 ';
|
|
|
- $sql.=' ,sku.Descr_C,FMLotNum,lot.LotAtt05,lot.LotAtt01,lot.LotAtt03,lot.LotAtt08,lot.LotAtt02,lot.LotAtt04 ';
|
|
|
+ $sql.=' ,sku.Descr_C,FMLotNum,lot.LotAtt05,lot.LotAtt01,lot.LotAtt08,lot.LotAtt02,lot.LotAtt04 ';
|
|
|
$sql.=' , storeStatus.QTY, storeStatus.QtyAllocated,stockLog.客户 ';
|
|
|
$sql.=' )result where 1=1 ';
|
|
|
if ($descr_c){
|
|
|
@@ -114,22 +114,23 @@ class InventoryAccountService
|
|
|
//全盘查询
|
|
|
private function conditionTotalStock($ownerId){
|
|
|
$descr_c=Owner::where('id',$ownerId)->value('name');
|
|
|
- $sql='select * from (select result.*,rownum rn from (';
|
|
|
+ $sql='select * from (select result.* from (';
|
|
|
$sql.=' select customer.Descr_C as 货主,storeStatus.CUSTOMERID 客户,storeStatus.LocationID 库位, sku.SKU 产品编码, sku.ALTERNATE_SKU1 产品条码1, sku.ALTERNATE_SKU2 产品条码2, sku.ALTERNATE_SKU3 产品条码3, ';
|
|
|
- $sql.=' sku.Descr_C 商品名称, lot.LotAtt05 属性仓, lot.LotAtt08 质量状态, lot.LotAtt02 失效日期, storeStatus.ADDTIME 创建时间, ';
|
|
|
- $sql.=' lot.LotAtt04 批号,lot.LotAtt01 生产日期,lot.LotAtt03 入库日期 ';
|
|
|
- $sql.=' , storeStatus.QTY 在库数量, storeStatus.QtyAllocated 占用数量,count(1) over () as sum from ';
|
|
|
+ $sql.=' sku.Descr_C 商品名称, lot.LotAtt05 属性仓, lot.LotAtt08 质量状态, lot.LotAtt02 失效日期, ';
|
|
|
+ $sql.=' lot.LotAtt04 批号,lot.LotAtt01 生产日期 ';
|
|
|
+ $sql.=' , SUM(storeStatus.QTY) 在库数量, SUM(storeStatus.QtyAllocated) 占用数量 from ';
|
|
|
$sql.=' INV_LOT_LOC_ID storeStatus';
|
|
|
$sql.=' left join BAS_Customer customer on customer.CustomerID=storeStatus.CUSTOMERID ';
|
|
|
$sql.=' left join BAS_SKU sku on sku.SKU=storeStatus.SKU and sku.CUSTOMERID=storeStatus.CUSTOMERID ';
|
|
|
$sql.=' left join INV_LOT_ATT lot on lot.LOTNUM = storeStatus.LOTNUM AND lot.CUSTOMERID = storeStatus.CUSTOMERID ';
|
|
|
$sql.=' group by storeStatus.LocationID,customer.Descr_C,sku.SKU,sku.ALTERNATE_SKU1,sku.ALTERNATE_SKU2,sku.ALTERNATE_SKU3 ';
|
|
|
$sql.=' ,sku.Descr_C,lot.LotAtt05,lot.LotAtt08,lot.LotAtt02,lot.LotAtt04 ';
|
|
|
- $sql.=' , storeStatus.QTY, storeStatus.QtyAllocated,storeStatus.CUSTOMERID,storeStatus.ADDTIME,lot.LotAtt01,lot.LotAtt03 ';
|
|
|
+ $sql.=' ,storeStatus.CUSTOMERID,lot.LotAtt01 ';
|
|
|
$sql.=' )result where 1=1 ';
|
|
|
if ($descr_c)$sql.=" and 货主 = '".$descr_c."' ";
|
|
|
$sql.=' ) ';
|
|
|
return DB::connection('oracle')->select($sql);
|
|
|
+
|
|
|
}
|
|
|
//创建盘点任务
|
|
|
public function createMission($date_start,$date_end,$ownerId){
|
|
|
@@ -188,7 +189,6 @@ class InventoryAccountService
|
|
|
LogService::log(__METHOD__,'foreach -- strat','createInventoryAccountMissionRecord');
|
|
|
foreach ($wmsInventories as $wmsInventory){
|
|
|
$commodity=$commoditiesArr[$wmsInventory->商品名称.'|'.$wmsInventory->产品编码]??null;
|
|
|
-// $commodity=$commodities->where('name',$wmsInventory->商品名称)->where('sku',$wmsInventory->产品编码)->first();
|
|
|
if (!$commodity){
|
|
|
$commodity=new Commodity();
|
|
|
$commodity->owner_id=$ownerId;
|
|
|
@@ -239,7 +239,7 @@ class InventoryAccountService
|
|
|
'location'=>$wmsInventory->库位,
|
|
|
'produced_at'=>$wmsInventory->生产日期,
|
|
|
'valid_at'=>$wmsInventory->失效日期,
|
|
|
- 'stored_at'=>$wmsInventory->入库日期,
|
|
|
+// 'stored_at'=>$wmsInventory->入库日期,
|
|
|
'batch_number'=>$wmsInventory->批号,
|
|
|
'erp_type_position'=>$wmsInventory->属性仓,
|
|
|
'quality'=>$quality,
|