新增手工配分

main
HUOJIN\92525 2024-09-11 14:49:30 +08:00
parent b8eca990f9
commit 6e7aff4b6b
13 changed files with 352 additions and 8 deletions

View File

@ -1013,11 +1013,6 @@ public class PickTicket extends AbstractMoveDoc {
} }
moveDocDetail.allocate(inventory, quantity); moveDocDetail.allocate(inventory, quantity);
this.allocatedQuantity += quantity; this.allocatedQuantity += quantity;
int precision=4;//moveDocDetail.getPackageUnit().getPrecision())
if (DoubleUtils.compareByPrecision(this.allocatedQuantity, this.orderQuantity,
precision)==0) {
this.setApplyDoc("");
}
this.status = PickTicketStatus.ALLOCATE; this.status = PickTicketStatus.ALLOCATE;
setUserTracking(); setUserTracking();
} }

View File

@ -92,6 +92,10 @@ public interface AutoAllocator extends BaseManager {
@Transactional @Transactional
void unallocate(AbstractMoveDoc moveDoc); void unallocate(AbstractMoveDoc moveDoc);
@Transactional
void unallocate(AbstractMoveDoc moveDoc,List<PickTicketDetail> details);
/** /**
* *
* @param bomDetail * @param bomDetail

View File

@ -8,6 +8,7 @@ import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set;
import org.apache.commons.beanutils.BeanComparator; import org.apache.commons.beanutils.BeanComparator;
import org.apache.commons.collections.comparators.ComparatorChain; import org.apache.commons.collections.comparators.ComparatorChain;
@ -29,6 +30,7 @@ import com.dev.swms.server.model.base.StorageType;
import com.dev.swms.server.model.base.TurnOverMode; import com.dev.swms.server.model.base.TurnOverMode;
import com.dev.swms.server.model.base.Warehouse; import com.dev.swms.server.model.base.Warehouse;
import com.dev.swms.server.model.inventory.Inventory; import com.dev.swms.server.model.inventory.Inventory;
import com.dev.swms.server.model.inventory.ItemKeyInventory;
import com.dev.swms.server.model.inventory.ProcessDoc; import com.dev.swms.server.model.inventory.ProcessDoc;
import com.dev.swms.server.model.inventory.ProcessDocBOMDetail; import com.dev.swms.server.model.inventory.ProcessDocBOMDetail;
import com.dev.swms.server.model.inventory.Stock; import com.dev.swms.server.model.inventory.Stock;
@ -1624,5 +1626,55 @@ public class DefaultAutoAllocator extends DefaultBaseManager implements AutoAllo
} }
return errorMsg; return errorMsg;
} }
@Override
public void unallocate(AbstractMoveDoc moveDoc,
List<PickTicketDetail> details) {
warehouseId = WarehouseHolder.getWarehouse().getId().longValue();
synchronized (warehouseId) {
for(AbstractMoveDocDetail detail : details){
List<Task> ts = new ArrayList<Task>();
for (Task task: detail.getTasks()) {
if(TaskType.MV_CROSS.equals(task.getType())){
continue;
}
double quantity = task.getPlanQuantityMU() - task.getMovedQuantityMU();
if (quantity == 0) {
ts.add(task);
continue;
}
if (moveDoc instanceof PickTicket) {
task.unallocatePick(quantity);
} else if(moveDoc instanceof WaveDoc){
task.unallocateWaveDoc(quantity);
}else if(moveDoc instanceof ProcessDoc){
task.unallocateProcessDoc(quantity);
}else{
task.unallocateMove(quantity);
}
ItemKey itemKey = task.getItemKey();
Warehouse w=WarehouseHolder.getWarehouse();
if(moveDoc.getWarehouse()!=null) {
w=moveDoc.getWarehouse();
}else {
w=task.getSrcLoc().getWarehouse();
}
Inventory inventory = itemKey.getInventoryWithException(w,task.getSrcLoc(),
task.getPackageUnit(), task.getSrcLP(),null, task.getInventoryStatus(),
task.getStorageDate(), task.getSOI());
inventory.unallocate(quantity, null, null);
if (task.getPlanQuantityMU()== 0) {
ts.add(task);
}
}
detail.getTasks().removeAll(ts);
}
}
}
} }

View File

@ -339,6 +339,8 @@ public interface PickTicketManager extends BaseManager {
*/ */
@Transactional @Transactional
void manualAllocatePick(Map params,List<Long> ids); void manualAllocatePick(Map params,List<Long> ids);
@Transactional @Transactional
void allocateAndPick(PickTicketDetail moveDocDetail,Inventory inv,Long workerId); void allocateAndPick(PickTicketDetail moveDocDetail,Inventory inv,Long workerId);
@ -420,4 +422,10 @@ public interface PickTicketManager extends BaseManager {
@Transactional @Transactional
void allocation(long pickTicketId,long warehouseId); void allocation(long pickTicketId,long warehouseId);
@Transactional
void shougongAllocate(Map clientParams,List<Long> id);
@Transactional
void cancellAllocate(List<Long> ids);
} }

View File

@ -25,6 +25,11 @@ import java.util.Map.Entry;
import org.apache.commons.beanutils.BeanUtils; import org.apache.commons.beanutils.BeanUtils;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.apache.http.HttpEntity; import org.apache.http.HttpEntity;
@ -473,6 +478,8 @@ public class DefaultPickTicketManager extends DefaultBaseManager implements
} }
} }
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public void allocateAndPick(PickTicketDetail moveDocDetailo,Inventory invo,Long workerId){ public void allocateAndPick(PickTicketDetail moveDocDetailo,Inventory invo,Long workerId){
PickTicketDetail moveDocDetail=this.commonDao.get(PickTicketDetail.class, moveDocDetailo.getId()); PickTicketDetail moveDocDetail=this.commonDao.get(PickTicketDetail.class, moveDocDetailo.getId());
@ -3100,4 +3107,52 @@ public class DefaultPickTicketManager extends DefaultBaseManager implements
public void allocation(long pickTicketId,long warehouseId) { public void allocation(long pickTicketId,long warehouseId) {
autoAllocator.allocate(pickTicketId, warehouseId); autoAllocator.allocate(pickTicketId, warehouseId);
} }
public void shougongAllocate(Map params,List<Long> id) {
PickTicketDetail pickTicketDetail = commonDao.load(PickTicketDetail.class, id.get(0));
manualAllocate(pickTicketDetail, params);
}
public void manualAllocate(AbstractMoveDocDetail moveDocDetail, Map params) {
AbstractMoveDoc pickTicket = moveDocDetail.getAbstractMoveDoc();
Double unallocateQty = moveDocDetail.getUnallocateQuantity();
Set<Map.Entry<Long, List>> itor = params.entrySet();
for (Map.Entry<Long, List> me : itor) {
Inventory inventory = commonDao.load(Inventory.class, me.getKey());
Double quantity = Double.parseDouble(me.getValue().get(0).toString());
if(quantity <= 0){
continue;
}
double kyQty=inventory.getQuantity()-inventory.getQueuedQuantity();
if (quantity > kyQty) {
quantity = kyQty;
}
if (quantity > unallocateQty) {
quantity = unallocateQty;
}
unallocateQty -= quantity;
pickTicket.allocate(moveDocDetail, inventory, quantity);
inventory.allocate(quantity, null, null);
}
}
@Override
public void cancellAllocate(List<Long> ids) {
List<PickTicketDetail> pds=new ArrayList<PickTicketDetail>();
PickTicket pickTicket = null;
for(Long pdId:ids){
PickTicketDetail pd=this.commonDao.get(PickTicketDetail.class, pdId);
pickTicket=pd.getPickTicket();
pds.add(pd);
}
autoAllocator.unallocate(pickTicket,pds);
}
} }

View File

@ -0,0 +1,166 @@
<?xml version="1.0" encoding="UTF-8"?>
<pages>
<maintainPage id="maintainPickTicketDetailManual2Page" title="库存信息" width="950" height="550" autoQuery="true">
<search>
<inputUIs>
<remote id="company.id" title="company" row="1" col="1" readOnly="false" required="false" reserve="false" forceOverride="false" inVisible="false" editModel="normal" manualEditable="true" displayedTableHead="序号,编码,名称">
<hql><![CDATA[select company.id, company.code, company.name from Structure company
where company.beCompany = true and upper(company.code) like upper(:param) or company.name like :param
and company.disabled=false
/~company.name: and company.name like {company.name} ~/
/~company.code: and company.code like {company.code} ~/
]]></hql>
</remote>
<list id="location.type" title="location.type" row="1" col="2" span="1" width="120" readOnly="false" required="false" reserve="false" forceOverride="false" enumType="LocationType">
<hql><![CDATA[ SELECT
enumerate.enumValue,
enumerate.enumValue From Enumerate enumerate
where enumerate.enumType = 'LocationType' order by enumerate.id]]></hql>
</list>
<list id="zone.id" title="zone" row="2" col="1" span="1" width="120px" readOnly="false" required="false" reserve="false" forceOverride="true">
<hql><![CDATA[select zone.id, zone.name from WarehouseArea zone
where 1=1
and zone.warehouse = #{SESSION_WAREHOUSE}
and zone.disabled=false]]></hql>
</list>
<remote id="location.id" title="location" row="2" col="2" readOnly="false" required="false" reserve="false" forceOverride="false" inVisible="false" editModel="normal" manualEditable="true" displayColumn="2" displayedTableHead="序号,库位编码,库位名称">
<hql><![CDATA[ select location.id, location.code, location.name
from Location location
where upper(location.code) like upper(:param)
and location.type <> 'COUNT' and location.disabled=false
]]></hql>
</remote>
<text id="item.code" title="item.code" row="3" col="1" readOnly="false" required="false" reserve="false" forceOverride="false" inVisible="false" trimSpace="false"/>
<text id="item.name" title="item.name" row="3" col="2" readOnly="false" required="false" reserve="false" forceOverride="false" inVisible="false" trimSpace="false"/>
<text id="packageUnit.unit" title="packageUnit.unit" row="4" col="1" readOnly="false" required="false" reserve="false" forceOverride="false" inVisible="false" trimSpace="false"/>
<text id="LP" title="stock.LP" row="4" col="2" span="1" readOnly="false" required="false" reserve="false" forceOverride="true" inVisible="false" trimSpace="false"/>
<text id="itemKeyLot" title="maintainInventoryPage.itemKeyId" row="5" span="1" readOnly="false" required="false" reserve="false" forceOverride="true" inVisible="false" trimSpace="true"/>
<text id="inventory.SOI" title="inventory.SOI" row="5" col="2" span="1" readOnly="false" required="false" reserve="false" forceOverride="true" inVisible="false" trimSpace="true"/>
<!-- <date id="inventory.storageDate" title="inventory.storageDate" row="6" span="1" readOnly="false" required="false" reserve="false" forceOverride="true" inVisible="false" showTime="false" manualEditable="true" defaultCurrentDate="false"/> -->
<text id="itemKey.content" title="inventory.itemKeyInventory.itemKey.content" row="6" col="2" span="1" readOnly="false" required="false" reserve="false" forceOverride="true" inVisible="false" trimSpace="true"/>
<numberText id="minQuantity" title="maintainInventoryPage.minQuantity" row="8" col="1" span="1" readOnly="false" required="false" reserve="false" forceOverride="true" inVisible="false" returnType="double"/>
<numberText id="maxQuantity" title="maintainInventoryPage.maxQuantity" row="8" col="1" span="1" readOnly="false" required="false" reserve="false" forceOverride="true" inVisible="false" returnType="double"/>
<dateRanger id="inventory.storageDate" title="inventory.storageDate" row="9" span="2" readOnly="false" required="false" reserve="false" forceOverride="false" inVisible="false" showTime="false" manualEditable="true" defaultCurrentDate="false" fromDate="storageDate1" toDate="storageDate2"/>
</inputUIs>
</search>
<datasource type="hql" displayRowCount="1"><![CDATA[SELECT
inventory.id,
inventory.quantity-inventory.queuedQuantity,
inventory.SOI,
company.name,
inventory.location.code,
inventory.location.type,
item.name,
ik.lotInfo.propC1,
item.specs,
inventory.itemKey.lotInfo.propC3,
round(inventory.quantity,4),
round(inventory.quantity/ik.lotInfo.propL1,2),
ik.lotInfo.propL1,
ik.lotInfo.propL2,
round(inventory.quantity/(ik.lotInfo.propL1*ik.lotInfo.propL2),2),
ik.lotInfo.propD1,
ik.lotInfo.propD2,
ik.lotInfo.propC4,
item.bgxx.itemNumber,
item.bgxx.hsCode,
item.bgxx.code,
item.customsRecord.itemNumber,
item.code,
round(inventory.queuedQuantity,4),
round(inventory.quantity-inventory.queuedQuantity,4),
item.weight*inventory.quantity,
inventory.status,
inventory.temperature,
ik.lotInfo.propC5,
ik.lotInfo.propC6,
inventory.storageDate,
inventory.storageDate as stockAge,
inventory.LP.LP,inventory.itemKey.id
FROM Inventory inventory
LEFT JOIN inventory.location location
LEFT JOIN inventory.location.zone
LEFT JOIN inventory.LP
left join inventory.itemKey ik
LEFT JOIN inventory.itemKey.company company
LEFT JOIN inventory.itemKey.item item
left join item.bgxx
left join item.customsRecord
WHERE 1=1
and inventory.quantity-inventory.queuedQuantity>0
and inventory.warehouse=#{SESSION_WAREHOUSE}
and item.id=(select d.item.id from PickTicketDetail d where d.id={id} )
and (inventory.SOI=(select d.pickTicket.relatedBill3 from PickTicketDetail d where d.id={id}) /~ordersAll: or true = {ordersAll}~/ )
/~company.id: AND company.id = {company.id}~/
/~location.id: AND inventory.location.id = {location.id}~/
/~zone.id: AND inventory.location.zone.id = {zone.id}~/
/~location.type: AND inventory.location.type = {location.type}~/
/~item.code: AND item.code LIKE {item.code}~/
/~item.name: AND item.name LIKE {item.name}~/
/~packageUnit.unit: AND inventory.packageUnit.unit LIKE {packageUnit.unit}~/
/~LP: AND inventory.LP.LP LIKE {LP}~/
/~itemKeyLot: AND inventory.itemKey.lot LIKE {itemKeyLot}~/
/~inventory.SOI: AND inventory.SOI LIKE {inventory.SOI}~/
/~storageDate1: AND inventory.storageDate >= {storageDate1}~/
/~storageDate1: AND inventory.storageDate <= {storageDate1}~/
/~itemKey.content: AND inventory.itemKey.content LIKE {itemKey.content}~/
/~minQuantity: AND inventory.quantity >= {minQuantity}~/
/~maxQuantity: AND inventory.quantity <= {maxQuantity}~/
order by inventory.location.code ,inventory.id desc
]]></datasource>
<columns>
<column id="inventory.id" title="ID" visible="false"/>
<column id="inventory.kyQuantity" title="kyQty" visible="true" horizonAlign="center" verticalAlign="middle" inputUI="text" inputUIValidator="integerRequired" />
<column id="inventory.SOI" title="inventory.SOI" visible="true" horizonAlign="left"/>
<column id="company.name" title="company.name" visible="true" horizonAlign="center" verticalAlign="middle" />
<column id="inventory.location.code" width="80" title="location.code" visible="true" horizonAlign="left" />
<column id="inventory.location.type" width="60" title="location.type" visible="true" horizonAlign="left" />
<column id="item.name" title="item.name" visible="true" horizonAlign="left"/>
<column id="lotInfo.propC1" width="80" title="lotInfo.propC1" visible="true" horizonAlign="left"/>
<column id="item.specs" width="60" title="item.specs" visible="true" horizonAlign="left"/>
<column id="inventory.packageUnit.unit" width="40" title="unit" visible="true" horizonAlign="left"/>
<column id="inventory.quantity" width="60" title="invQty" visible="true" horizonAlign="right"/>
<column id="caseQty" width="80" title="caseQty" visible="true" horizonAlign="left"/>
<column id="lotInfo.propL1" width="60" title="lotInfo.propL1" visible="true" horizonAlign="left"/>
<column id="lotInfo.propL2" width="60" title="lotInfo.propL2" visible="true" horizonAlign="left"/>
<column id="lpQty" width="80" title="lpQty" visible="true" horizonAlign="left"/>
<column id="lotInfo.propD1" width="80" title="lotInfo.propD1" visible="true" horizonAlign="left"/>
<column id="lotInfo.propD2" width="80" title="lotInfo.propD2" visible="true" horizonAlign="left"/>
<column id="lotInfo.propC4" width="80" title="lotInfo.propC4" visible="true" horizonAlign="left"/>
<column id="item.bgxx.itemNumber" width="50" title="item.bgxx.itemNumber" visible="true" horizonAlign="left" />
<column id="item.bgxx.hsCode" width="60" title="item.bgxx.hsCode" visible="true" horizonAlign="left"/>
<column id="item.bgxx.code" width="80" title="item.bgxx.code" visible="true" horizonAlign="left"/>
<column id="item.customsRecord.code" width="80" title="非保项号" visible="true" horizonAlign="left"/>
<column id="item.code" width="80" title="item.code" visible="true" horizonAlign="left" sortIndex="4"/>
<column id="inventory.queuedQuantity" width="60" title="zyQty" visible="true" horizonAlign="right"/>
<column id="weight" width="80" title="weight" visible="true" horizonAlign="left"/>
<column id="inventory.status" width="60" title="inventory.status" visible="true" horizonAlign="left"/>
<column id="customsOrder.temperature" title="customsOrder.temperature" visible="true" horizonAlign="center" verticalAlign="middle"/>
<column id="lotInfo.propC5" title="lotInfo.propC5" visible="true" horizonAlign="center" verticalAlign="middle"/>
<column id="lotInfo.propC6" title="lotInfo.propC6" visible="true" horizonAlign="center" verticalAlign="middle"/>
<column id="inventory.storageDate" title="inventory.storageDate" visible="true" horizonAlign="left"/>
<column id="stockAge" width="60" title="lotInfo.stockAge" visible="true" horizonAlign="left" />
<column id="inventory.LP.LP" title="inventory.LP" visible="true" horizonAlign="left"/>
</columns>
<buttons>
<commit id="allocate" title="分配确认" enableType="multi" invisible="false">
<mappings>
<mapping id="map" className="map"/>
<mapping id="parentIds" className="list"/>
</mappings>
<actions>
<action managerName="pickTicketManager" methodName="shougongAllocate" parameter="map,parentIds"/>
</actions>
<forwards>
<forward name="refreshWindow" newEnabled="true" editEnabled="true"/>
<forward name="closeWindow" newEnabled="true" editEnabled="true"/>
<forward name="refreshParent" newEnabled="true" editEnabled="true"/>
</forwards>
</commit>
</buttons>
</maintainPage>
</pages>

View File

@ -191,9 +191,14 @@
<forward name="refreshWindow" newEnabled="true" editEnabled="true"/> <forward name="refreshWindow" newEnabled="true" editEnabled="true"/>
</forwards> </forwards>
</commit> </commit>
<popup id="manualAllocate" title="manualAllocate" enableType="single" invisible="false" containId="true" pageId="manualPickingAllocatePage">
<popup id="manualAllocate" title="manualAllocate" enableType="single" invisible="false" containId="true" pageId="modifyPickTicketManual2Page">
<enableExpression><![CDATA[( ${pickTicket.status} !='SHIP_ALL' && ${pickTicket.invoiceBox.beBonded} =='false') ]]></enableExpression> <enableExpression><![CDATA[( ${pickTicket.status} !='SHIP_ALL' && ${pickTicket.invoiceBox.beBonded} =='false') ]]></enableExpression>
</popup> </popup>
<!-- <popup id="manualAllocate" title="manualAllocate" enableType="single" invisible="false" containId="true" pageId="manualPickingAllocatePage">
<enableExpression><![CDATA[( ${pickTicket.status} !='SHIP_ALL' && ${pickTicket.invoiceBox.beBonded} =='false') ]]></enableExpression>
</popup> -->
<commit id="unallocate" title="maintainPickTicketPage.unallocate" enableType="multi" invisible="false" confirmMessage="maintainPickTicketPage.unallocate.confirmMessage"> <commit id="unallocate" title="maintainPickTicketPage.unallocate" enableType="multi" invisible="false" confirmMessage="maintainPickTicketPage.unallocate.confirmMessage">
<enableExpression><![CDATA[( ${pickTicket.status} !='SHIP_ALL' && ${pickTicket.invoiceBox.beBonded} =='false') ]]></enableExpression> <enableExpression><![CDATA[( ${pickTicket.status} !='SHIP_ALL' && ${pickTicket.invoiceBox.beBonded} =='false') ]]></enableExpression>
<mappings> <mappings>

View File

@ -0,0 +1,59 @@
<?xml version="1.0" encoding="UTF-8"?>
<pages>
<modifyDetailPage id="modifyPickTicketManual2Page" title="手工分配" entityClass="com.dev.swms.server.model.shipping.PickTicket" onClose="refreshParent" width="900" height="400">
<modify>
<inputUIs>
<hidden id="pickTicket.id" reserve="false"/>
<hidden id="pickTicket.status" reserve="false"/>
</inputUIs>
</modify>
<detail autoQuery="true">
<datasource><![CDATA[ SELECT
pickTicketDetail.id,
(pickTicketDetail.orderQuantity-pickTicketDetail.allocatedQuantity) as unQllocatedQuantity,
pickTicketDetail.orderQuantity,
pickTicketDetail.allocatedQuantity,
pickTicketDetail.item.company.name,
pickTicketDetail.item.code,
pickTicketDetail.item.name,
pickTicketDetail.item.specs
FROM PickTicketDetail pickTicketDetail
left join pickTicketDetail.item
left join pickTicketDetail.item.company
left join pickTicketDetail.pickTicket
left join pickTicketDetail.packageUnit
WHERE 1=1
/~pickTicket.id: AND pickTicketDetail.pickTicket.id = {pickTicket.id}~/
order by pickTicketDetail.id
]]></datasource>
<columns>
<column id="pickTicketDetail.id" title="ID" visible="false"/>
<column id="unQllocatedQuantity" title="未分配数量" width="80" visible="true" horizonAlign="left"/>
<column id="pickTicketDetail.orderQuantity" title="pickTicketDetail.orderQuantity" width="95" visible="true" horizonAlign="right"/>
<column id="pickTicketDetail.allocatedQuantity" title="pickTicketDetail.allocatedQuantity" visible="true" horizonAlign="right"/>
<column id="pickTicketDetail.item.company.name" title="company.name" width="120" visible="true" horizonAlign="left" />
<column id="pickTicketDetail.item.code" title="item.code" width="200" visible="true" horizonAlign="left"/>
<column id="pickTicketDetail.item.name" title="item.name" width="200" visible="true" horizonAlign="left"/>
<column id="pickTicketDetail.item.specs" title="item.specs" width="100" visible="true" horizonAlign="center" verticalAlign="middle" />
</columns>
<buttons>
<popup id="allocate" title="分配" enableType="single" invisible="false" containId="true" pageId="maintainPickTicketDetailManual2Page"/>
<commit id="unallocate" title="取消分配" enableType="single" invisible="false" confirmMessage="maintainPickTicketPage.unallocate.confirmMessage">
<enableExpression><![CDATA[(${pickTicket.status} =='ALLOCATE') ]]></enableExpression>
<mappings>
<mapping id="ids" className="list"/>
</mappings>
<actions>
<action managerName="pickTicketManager" methodName="cancellAllocate" parameter="ids"/>
</actions>
<forwards>
<forward name="refreshWindow" newEnabled="true" editEnabled="true"/>
</forwards>
</commit>
</buttons>
</detail>
</modifyDetailPage>
</pages>