Index: ssts-web/src/main/webapp/dataUpdater/4.0升级4.1脚本/服务器启动之后执行的脚本.txt =================================================================== diff -u --- ssts-web/src/main/webapp/dataUpdater/4.0升级4.1脚本/服务器启动之后执行的脚本.txt (revision 0) +++ ssts-web/src/main/webapp/dataUpdater/4.0升级4.1脚本/服务器启动之后执行的脚本.txt (revision 13237) @@ -0,0 +1,118 @@ + +/* �ȷ�������4.1����������֮����ִ�д������ű� */ + +/* һ������Ʒ��� */ +/* ��Ҫ���ö�Ӧ�IJֿ⣬Ȼ��'��Ժ�ֿ�'�滻Ϊ���õIJֿ��� */ +delete from IdentificationOfDisposableGoods; +delete from DisposableGoodsBatchStock; +delete from DisposableGoodsStock; +delete from DisposableGoodsBatch; +delete from DisposableGoods; + +/* ����һ������Ʒ����*/ +set identity_insert DisposableGoods on +insert into DisposableGoods (id,amount,certification,externalCode,guid,inventorySerialNumber,isApplicationMaterial,isPartOfTousseMaterial,isSupplyRoomGoods,maxStorage,minApplyAmount,minStorage,name,packageSpec,referencePrice,specification,spelling,type,unit,unitConvertCoefficient,wbCode) (select id,amount,certification,externalCode,guid,inventorySerialNumber,isApplicationMaterial,isPartOfTousseMaterial,isSupplyRoomGoods,maxStorage,minApplyAmount,minStorage,name,packageSpec,referencePrice,specification,spelling,type,unit,unitConvertCoefficient,wbCode from DiposableGoods) +set identity_insert DisposableGoods off + +/* ����һ������Ʒ���*/ +set identity_insert DisposableGoodsStock on +insert into DisposableGoodsStock (id,amount,certification,externalCode,guid,inventorySerialNumber,isApplicationMaterial,isPartOfTousseMaterial,isSupplyRoomGoods,maxStorage,minApplyAmount,minStorage,name,packageSpec,referencePrice,specification,spelling,type,unit,unitConvertCoefficient,wbCode) (select id,amount,certification,externalCode,guid,inventorySerialNumber,isApplicationMaterial,isPartOfTousseMaterial,isSupplyRoomGoods,maxStorage,minApplyAmount,minStorage,name,packageSpec,referencePrice,specification,spelling,type,unit,unitConvertCoefficient,wbCode from DiposableGoods) +set identity_insert DisposableGoodsStock off +update DisposableGoodsStock set disposableGoodsID=id; +update DisposableGoodsStock set warehouseID=(select id from WareHouse where name='��Ժ�ֿ�'); +update DisposableGoodsStock set warehouseName='��Ժ�ֿ�'; +/* ����һ������Ʒ���ζ���*/ +insert into DisposableGoodsBatch (id,batchNumber,cost,expDate,manufacturer,sterileBatchNumber,storage,supplierName,diposablegoods_id,producingArea) (select d.id,d.batchNumber,d.cost,d.expDate,d.manufacturer,d.sterileBatchNumber,d.storage,d.supplierName,d.diposablegoods_id,d.producingArea from DiposableGoodBatchStock d inner join BarcodeDevice b on d.id=b.id) + +/* DiposableGoodBatchStock ����Ϊ DisposableGoodsBatchStock ������һ������Ʒ���ο��*/ +delete from DisposableGoodsBatchStock; +set identity_insert DisposableGoodsBatchStock on +insert into DisposableGoodsBatchStock (id,barcode,batchNumber,cost,expDate,manufacturer,sterileBatchNumber,storage,supplierName,diposablegoods_id,producingArea) (select d.id,b.barcode,d.batchNumber,d.cost,d.expDate,d.manufacturer,d.sterileBatchNumber,d.storage,d.supplierName,d.diposablegoods_id,d.producingArea from DiposableGoodBatchStock d inner join BarcodeDevice b on d.id=b.id) +set identity_insert DisposableGoodsBatchStock off +update DisposableGoodsBatchStock set disposableGoodsID=diposablegoods_id; +update DisposableGoodsBatchStock set disposableGoodsBatchID=id; +update DisposableGoodsBatchStock set warehouseID=(select id from WareHouse where name='��Ժ�ֿ�'); +update DisposableGoodsBatchStock set warehouseName='��Ժ�ֿ�'; + +/* IdentificationOfDiposableGoods ����Ϊ IdentificationOfDisposableGoods */ +delete from IdentificationOfDisposableGoods; +set identity_insert IdentificationOfDisposableGoods on +insert into IdentificationOfDisposableGoods (id,amount,conclusion,entryDate,identification,price,batch_id) (select id,amount,conclusion,entryDate,identification,price,batch_id from IdentificationOfDiposableGoods) +set identity_insert IdentificationOfDisposableGoods off +update IdentificationOfDisposableGoods set disposableGoodsID=(select TOP 1 diposablegoods_id from DiposableGoodBatchStock where id=batch_id); +update IdentificationOfDisposableGoods set disposableGoodsStockID=batch_id; +update IdentificationOfDisposableGoods set disposableGoodsBatchID=batch_id; +update IdentificationOfDisposableGoods set warehouseID=(select id from WareHouse where name='��Ժ�ֿ�'); +update IdentificationOfDisposableGoods set warehouseName='��Ժ�ֿ�'; + +/* ������ⵥ�IJֿ���Ϣ */ +update GodownEntry set wareHouseId=(select id from WareHouse where name='��Ժ�ֿ�'); +update GodownEntry set wareHouseName='��Ժ�ֿ�'; +/* ������ⵥ��ϸ��һ������Ʒ��Ϣ */ +update GodownEntryItem set disposableGoodsID=diposableGoodsID,disposableGoodsStockID=diposableGoodsID,disposableGoodsBatchID=batchID,disposableGoodsBatchStockID=batchID; +/* ������ⵥ��ϸ�IJֿ���Ϣ */ +update GodownEntryItem set wareHouseId=(select id from WareHouse where name='��Ժ�ֿ�'); +update GodownEntryItem set wareHouseName='��Ժ�ֿ�'; +/* ������ⵥһ������Ʒ��ϸ��һ������Ʒ��Ϣ */ +update GodownEntryDiposableGoodsItem set disposableGoodsID=diposableGoodsID,disposableGoodsStockID=diposableGoodsID,disposableGoodsBatchID=batchID,disposableGoodsBatchStockID=batchID; + + +/* �����̵��¼�IJֿ���Ϣ */ +update StockTakeInfo set warehouseID=(select id from WareHouse where name='��Ժ�ֿ�'); +update StockTakeInfo set warehouseName='��Ժ�ֿ�'; +/* �����̵��¼��ϸ��һ������Ʒ��Ϣ */ +update StockTakeItem set disposableGoodsId=diposableGoodsID,disposableGoodsStockId=diposableGoodsID,disposableGoodsBatchId=batchID,disposableGoodsBatchStockId=batchID; +/* �����̵��¼��ϸ�IJֿ���Ϣ */ +update StockTakeItem set wareHouseId=(select id from WareHouse where name='��Ժ�ֿ�'); +update StockTakeItem set wareHouseName='��Ժ�ֿ�'; + +/* ���÷������IJֿ���Ϣ */ +update Invoice set warehouseID=(select id from WareHouse where name='��Ժ�ֿ�'); +update Invoice set warehouseName='��Ժ�ֿ�'; +update Invoice set sourceWarehouseId=(select id from WareHouse where name='��Ժ�ֿ�'); +update Invoice set sourceWarehouseName='��Ժ�ֿ�'; +/* ���÷�������ϸ�IJֿ���Ϣ */ +update InvoiceItem set wareHouseId=(select id from WareHouse where name='��Ժ�ֿ�'); +update InvoiceItem set wareHouseName='��Ժ�ֿ�'; +/* ���÷�����һ������Ʒ��ϸ��һ������Ʒ��Ϣ */ +update DiposableGoodsItem set disposableGoodsId=diposableGoodsID,disposableGoodsStockId=diposableGoodsID,disposableGoodsBatchId=batchID,disposableGoodsBatchStockId=batchID; + +/* �����˻���¼�IJֿ���Ϣ */ +update ReturnGoodsRecord set warehouseID=(select id from WareHouse where name='��Ժ�ֿ�'); +update ReturnGoodsRecord set warehouseName='��Ժ�ֿ�'; +update ReturnGoodsRecord set srcWarehouseID=(select id from WareHouse where name='��Ժ�ֿ�'); +update ReturnGoodsRecord set srcWarehouseName='��Ժ�ֿ�'; +/* �����˻���¼��ϸ��һ������Ʒ��Ϣ */ +update ReturnGoodsItem set disposableGoodsId=diposableGoodsID,disposableGoodsStockId=diposableGoodsID,disposableGoodsBatchId=batchID,disposableGoodsBatchStockId=batchID; + +/* ����������е���Զ�����е���ı�ʶ�� */ +update TousseDefinition set isDisableIDCard='��' where tousseType in('������е��','�Զ�����е��') + +/* �������̵����ݴ��� */ +update StockIdentificationOfGoods set price=0 where price is null +update StockIdentificationOfGoods set amount=0 where amount is null + +--2.��е��ʵ�������ֿ��ֶθ��� +update TousseInstance set wareHouseName='��Ժ��Ӧ�Ҳֿ�', wareHouseId = (select id from WareHouse where name='��Ժ��Ӧ�Ҳֿ�') where status in ('�����','������'); +update TousseInstance set wareHouseName=(select w.name from WareHouse w join Invoice i on w.id=i.warehouseID where i.id=TousseInstance.invoice_id), wareHouseId = (select w.id from WareHouse w join Invoice i on w.id=i.warehouseID where i.id=TousseInstance.invoice_id) where status='�ѷ���'; +--3.���뵥�Ĵ������ +update invoicePlan set handleDepart='��Ժ��Ӧ��', handleDepartCoding=(select orgUnitCoding from OrgUnit where name='��Ժ��Ӧ��'); +--4.�˻�������ϸ�ֿ��ֶθ��� +update ReturnGoodsRecord set warehouseName='��Ժ��Ӧ�Ҳֿ�',warehouseID=(select id from WareHouse where name='��Ժ��Ӧ�Ҳֿ�'); +update ReturnGoodsItem set warehouseName='��Ժ��Ӧ�Ҳֿ�',warehouseID=(select id from WareHouse where name='��Ժ��Ӧ�Ҳֿ�'); +--5.������һ������Ʒ�̵㼰��ϸ�ֿ��ֶ� +update StockTakeInfo set warehouseName='��Ժ��Ӧ�Ҳֿ�',warehouseID=(select id from WareHouse where name='��Ժ��Ӧ�Ҳֿ�'); +update StockTakeItem set warehouseName='��Ժ��Ӧ�Ҳֿ�',warehouseID=(select id from WareHouse where name='��Ժ��Ӧ�Ҳֿ�'); +--6.����������ϸ�ֿ��ֶθ��� +update invoice set sourceWareHouseName='��Ժ��Ӧ�Ҳֿ�',sourceWarehouseID=(select id from WareHouse where name='��Ժ��Ӧ�Ҳֿ�'); +--wareHouseName=(select w.name from WareHouse w join OrgUnit o on w.orgUnitCode=o.orgUnitCoding where o.name=invoice.depart), wareHouseId = (select w.id from WareHouse w join OrgUnit o on w.orgUnitCode=o.orgUnitCoding where o.name=invoice.depart); +update InvoiceItem set warehouseName='��Ժ��Ӧ�Ҳֿ�',warehouseID=(select id from WareHouse where name='��Ժ��Ӧ�Ҳֿ�'); + +--8.������/�˿ⵥ����ϸ�ֿ��ֶθ��� +update MaterialEntry set warehouseName='��Ժ��Ӧ�Ҳֿ�',warehouseID=(select id from WareHouse where name='��Ժ��Ӧ�Ҳֿ�'); +update MaterialEntryItem set warehouseName='��Ժ��Ӧ�Ҳֿ�',warehouseID=(select id from WareHouse where name='��Ժ��Ӧ�Ҳֿ�'); +--9.��е��/���Ͽ�������� +insert into GoodsStock(amount,goodsType,name,orgUnitName,orgUnitCode,tousseDefinitionId,wareHouseName,wareHouseId) +select count(0),'��е��',tousseName,'��Ժ��Ӧ��',(select orgUnitCoding from OrgUnit where name='��Ժ��Ӧ��'),tousseDefinition_id,'��Ժ��Ӧ�Ҳֿ�',(select id from WareHouse where name='��Ժ��Ӧ�Ҳֿ�') from TousseInstance where status in ('�����','������') group by tousseName,tousseDefinition_id; +insert into GoodsStock(amount,goodsType,name,orgUnitName,orgUnitCode,materialDefinitionId,wareHouseName,wareHouseId) +select sum(m.storage),'����',name,'��Ժ��Ӧ��',(select orgUnitCoding from OrgUnit where name='��Ժ��Ӧ��'),id,'��Ժ��Ӧ�Ҳֿ�',(select id from WareHouse where name='��Ժ��Ӧ�Ҳֿ�') from MaterialDefinition m group by id , name; Index: ssts-web/src/main/webapp/dataUpdater/4.0升级4.1脚本/服务器启动之前执行的脚本.txt =================================================================== diff -u --- ssts-web/src/main/webapp/dataUpdater/4.0升级4.1脚本/服务器启动之前执行的脚本.txt (revision 0) +++ ssts-web/src/main/webapp/dataUpdater/4.0升级4.1脚本/服务器启动之前执行的脚本.txt (revision 13237) @@ -0,0 +1,6 @@ + +/* ����������֮ǰɾ������2�����,��ͬ���ݿ�����������һ���������ʵ�����ݿ�����Ӧ���� */ +/* ɾ��ReturnGoodsItem����DiposableGoodBatchStock�����*/ +alter table ReturnGoodsItem drop constraint FK8C4B5C192E925BFF +/* ɾ�� GodownEntryItem ���� DiposableGoods ����� */ +alter table GodownEntryItem drop constraint FKE4F2641B38D8B375 \ No newline at end of file