现存量表变更一、目的:为了处理不同单据同维度并发时的阻塞,把同一行上不同单据数量拆分成多行,这样不同单据同维度并发时不会阻塞。二、方案:修改物理表结构,删除原表各单据数量(如订单在途量),新增字段PropertyName(订单在途),并删除了一些无用的字段。三、物理表变化如下:1.名称变更,ST_CurrentStock改为ST_NewCurrentStock2.结构变更字段名描述propertyName新增字段,标识数量对应的属性名baseQuantitysubQuantitybatchexpiryDatecreatedtimefreeItem0freeItem1freeItem2freeItem3freeItem4freeItem5freeItem6freeItem7freeItem8freeItem9idinventoryIdMarketingOrganidsubunitididbaseunitidwarehouseisCarriedForwardInisCarriedForwardOutproductionDatereceiveVoucherCodereceiveVoucherDetailIdreceiveVoucherIdtsupdatedcanUseBaseQuantity删除canUseSubQuantitychangeRateDelegateForDispatchBaseQuantityDelegateForDispatchSubQuantityDelegateForReceiveBaseQuantityDelegateForReceiveSubQuantityDelegateOrderForMaterialBaseQuantityDelegateOrderForMaterialSubQuantityDelegateOrderForProductBaseQuantityDelegateOrderForProductSubQuantityforDispatchBaseQuantityforDispatchSubQuantityforSaleDispatchBaseQuantityforSaleDispatchSubQuantityforSaleOrderBaseQuantityforSaleOrderSubQuantityidBatchDispatchDTOidvoucherunitidvoucherunit2lowQuantitymaterialForSendBaseQuantitymaterialForSendSubQuantityonProducingBaseQuantityonProducingSubQuantityonWayBaseQuantityonWaySubQuantityotherForDispatchBaseQuantityotherForDispatchSubQuantityotherOnWayBaseQuantityotherOnWaySubQuantitypreBaseQuantitypreSubQuantityProduceForDispatchBaseQuantityProduceForDispatchSubQuantityproductForReceiveBaseQuantityproductForReceiveSubQuantitypurchaseArrivalBaseQuantitypurchaseArrivalSubQuantitypurchaseForReceiveBaseQuantitypurchaseForReceiveSubQuantitypurchaseOrderOnWayBaseQuantitypurchaseOrderOnWaySubQuantitysaleDeliveryBaseQuantitysaleDeliverySubQuantitystockRequestBaseQuantitystockRequestSubQuantitytopQuantitytransForDispatchBaseQuantitytransForDispatchSubQuantitytransOnWayBaseQuantitytransOnWaySubQuantityupdatedByvoucherQuantityvoucherQuantity2四、新增查询视图,名称为ST_CurrentStock,和原物理表名称与结构保持一致,为了不影响所有查询的地方。五、二次开发影响点:1.记量:原表新增sql:INSERTST_CurrentStock(idinventory,idwarehouse,updated,batch,purchaseOrderOnWayBaseQuantity)VALUES(1,1,getdate(),'batch01',2)新表新增sql:INSERTST_NewCurrentStock(idinventory,idwarehouse,updated,batch,propertyName,BaseQuantity)VALUES(1,1,getdate(),'batch01','purchaseOrderOnWay',2)PropertyName名字是怎么来的?就是把原数量字段名字的BaseQuantity去掉就是,也可以去ST_StockProperty里查询所有属性的名字2.查询:这块基本没有什么变化,唯一的变化就是,现在可以直接从视图ST_CurrentStock查询出来可用量(根据用户选项勾选什么单据参与可用量来计算的),不需要再动态的拼接计算字段了。